@@ -54,7 +54,7 @@ def run_cmd(cmd, env, cwd=None):
5454 for line in iter (process .stdout .readline , "" ):
5555 print (line , end = "" )
5656 out .append (line )
57- return "" .join (out )
57+ return "" .join (out ), process . wait ()
5858
5959def get_executable (file ):
6060 if os .path .isfile (file ):
@@ -108,7 +108,7 @@ def test_polyglot_app():
108108 target_dir = os .path .join (tmpdir , "polyglot_app_test" )
109109
110110 cmd = [graalpy , "-m" , "standalone" , "--verbose" , "polyglot_app" , "-o" , target_dir ]
111- out = run_cmd (cmd , env )
111+ out , return_code = run_cmd (cmd , env )
112112 assert "Creating polyglot java python application in directory " + target_dir in out
113113
114114 if custom_repos := os .environ .get ("MAVEN_REPO_OVERRIDE" ):
@@ -137,11 +137,11 @@ def test_polyglot_app():
137137 """ ))
138138
139139 cmd = MVN_CMD + ["package" , "-Pnative" ]
140- out = run_cmd (cmd , env , cwd = target_dir )
140+ out , return_code = run_cmd (cmd , env , cwd = target_dir )
141141 assert "BUILD SUCCESS" in out
142142
143143 cmd = [os .path .join (target_dir , "target" , "polyglot_app" )]
144- out = run_cmd (cmd , env , cwd = target_dir )
144+ out , return_code = run_cmd (cmd , env , cwd = target_dir )
145145 assert out .endswith ("hello java\n " )
146146
147147
@@ -162,11 +162,15 @@ def test_native_executable_one_file():
162162 target_file = os .path .join (tmpdir , "hello" )
163163 cmd = [graalpy , "-m" , "standalone" , "--verbose" , "native" , "-m" , source_file , "-o" , target_file ]
164164
165- out = run_cmd (cmd , env )
165+ out , return_code = run_cmd (cmd , env )
166166 assert "Bundling Python resources into" in out
167167
168168 cmd = [target_file , "arg1" , "arg2" ]
169- out = run_cmd (cmd , env )
169+ out , return_code = run_cmd (cmd , env )
170+ if sys .platform == 'win32' :
171+ # sigh. it seems the output capture doesn't work on our CI machines (but works for the first command...)
172+ # just check the return code
173+ assert return_code == 0
170174 assert "hello world, argv[1:]: " + str (cmd [1 :]) in out
171175
172176@unittest .skipUnless (is_enabled , "ENABLE_STANDALONE_UNITTESTS is not true" )
@@ -189,19 +193,19 @@ def test_native_executable_venv_and_one_file():
189193
190194 venv_dir = os .path .join (target_dir , "venv" )
191195 cmd = [graalpy , "-m" , "venv" , venv_dir ]
192- out = run_cmd (cmd , env )
196+ out , return_code = run_cmd (cmd , env )
193197
194198 venv_python = os .path .join (venv_dir , "Scripts" , "python.cmd" ) if os .name == "nt" else os .path .join (venv_dir , "bin" , "python" )
195199 cmd = [venv_python , "-m" , "pip" , "--no-cache-dir" , "install" , "termcolor" , "ujson" ]
196- out = run_cmd (cmd , env )
200+ out , return_code = run_cmd (cmd , env )
197201
198202 target_file = os .path .join (target_dir , "hello" )
199203 cmd = [graalpy , "-m" , "standalone" , "--verbose" , "native" , "-Os" , "-m" , source_file , "--venv" , venv_dir , "-o" , target_file ]
200- out = run_cmd (cmd , env )
204+ out , return_code = run_cmd (cmd , env )
201205 assert "Bundling Python resources into" in out
202206
203207 cmd = [target_file ]
204- out = run_cmd (cmd , env )
208+ out , return_code = run_cmd (cmd , env )
205209
206210 assert "hello standalone world" in out
207211 assert "key=value" in out
@@ -231,9 +235,13 @@ def test_native_executable_module():
231235 target_file = os .path .join (tmp_dir , "hello" )
232236 cmd = [graalpy , "-m" , "standalone" , "--verbose" , "native" , "-Os" , "-m" , module_dir , "-o" , target_file ]
233237
234- out = run_cmd (cmd , env )
238+ out , return_code = run_cmd (cmd , env )
235239 assert "Bundling Python resources into" in out
236240
237241 cmd = [target_file ]
238- out = run_cmd (cmd , env )
242+ out , return_code = run_cmd (cmd , env )
243+ if sys .platform == 'win32' :
244+ # sigh. it seems the output capture doesn't work on our CI machines (but works for the first command...)
245+ # just check the return code
246+ assert return_code == 0
239247 assert "hello standalone world" in out
0 commit comments