@@ -130,6 +130,44 @@ def test_exec_command_with_exec_env(self, os_ops: OsOperations):
130130 assert type (response ) == bytes # noqa: E721
131131 assert response == b'\n '
132132
133+ def test_exec_command_with_exec_env__2 (self , os_ops : OsOperations ):
134+ assert isinstance (os_ops , OsOperations )
135+
136+ RunConditions .skip_if_windows ()
137+
138+ C_ENV_NAME = "TESTGRES_TEST__EXEC_ENV_20250414"
139+
140+ tmp_file_content = "echo ${{{}}}" .format (C_ENV_NAME )
141+
142+ logging .info ("content is [{}]" .format (tmp_file_content ))
143+
144+ tmp_file = os_ops .mkstemp ()
145+ assert type (tmp_file ) == str # noqa: E721
146+ assert tmp_file != ""
147+
148+ logging .info ("file is [{}]" .format (tmp_file ))
149+ assert os_ops .path_exists (tmp_file )
150+
151+ os_ops .write (tmp_file , tmp_file_content )
152+
153+ cmd = ["sh" , tmp_file ]
154+
155+ exec_env = {C_ENV_NAME : "Hello!" }
156+
157+ response = os_ops .exec_command (cmd , exec_env = exec_env )
158+ assert response is not None
159+ assert type (response ) == bytes # noqa: E721
160+ assert response == b'Hello!\n '
161+
162+ response = os_ops .exec_command (cmd )
163+ assert response is not None
164+ assert type (response ) == bytes # noqa: E721
165+ assert response == b'\n '
166+
167+ os_ops .remove_file (tmp_file )
168+ assert not os_ops .path_exists (tmp_file )
169+ return
170+
133171 def test_exec_command_with_cwd (self , os_ops : OsOperations ):
134172 assert isinstance (os_ops , OsOperations )
135173
0 commit comments