@@ -54,7 +54,7 @@ def run_cmd(cmd, env, cwd=None):
54
54
for line in iter (process .stdout .readline , "" ):
55
55
print (line , end = "" )
56
56
out .append (line )
57
- return "" .join (out )
57
+ return "" .join (out ), process . wait ()
58
58
59
59
def get_executable (file ):
60
60
if os .path .isfile (file ):
@@ -108,7 +108,7 @@ def test_polyglot_app():
108
108
target_dir = os .path .join (tmpdir , "polyglot_app_test" )
109
109
110
110
cmd = [graalpy , "-m" , "standalone" , "--verbose" , "polyglot_app" , "-o" , target_dir ]
111
- out = run_cmd (cmd , env )
111
+ out , return_code = run_cmd (cmd , env )
112
112
assert "Creating polyglot java python application in directory " + target_dir in out
113
113
114
114
if custom_repos := os .environ .get ("MAVEN_REPO_OVERRIDE" ):
@@ -137,11 +137,11 @@ def test_polyglot_app():
137
137
""" ))
138
138
139
139
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 )
141
141
assert "BUILD SUCCESS" in out
142
142
143
143
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 )
145
145
assert out .endswith ("hello java\n " )
146
146
147
147
@@ -162,11 +162,15 @@ def test_native_executable_one_file():
162
162
target_file = os .path .join (tmpdir , "hello" )
163
163
cmd = [graalpy , "-m" , "standalone" , "--verbose" , "native" , "-m" , source_file , "-o" , target_file ]
164
164
165
- out = run_cmd (cmd , env )
165
+ out , return_code = run_cmd (cmd , env )
166
166
assert "Bundling Python resources into" in out
167
167
168
168
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
170
174
assert "hello world, argv[1:]: " + str (cmd [1 :]) in out
171
175
172
176
@unittest .skipUnless (is_enabled , "ENABLE_STANDALONE_UNITTESTS is not true" )
@@ -189,19 +193,19 @@ def test_native_executable_venv_and_one_file():
189
193
190
194
venv_dir = os .path .join (target_dir , "venv" )
191
195
cmd = [graalpy , "-m" , "venv" , venv_dir ]
192
- out = run_cmd (cmd , env )
196
+ out , return_code = run_cmd (cmd , env )
193
197
194
198
venv_python = os .path .join (venv_dir , "Scripts" , "python.cmd" ) if os .name == "nt" else os .path .join (venv_dir , "bin" , "python" )
195
199
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 )
197
201
198
202
target_file = os .path .join (target_dir , "hello" )
199
203
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 )
201
205
assert "Bundling Python resources into" in out
202
206
203
207
cmd = [target_file ]
204
- out = run_cmd (cmd , env )
208
+ out , return_code = run_cmd (cmd , env )
205
209
206
210
assert "hello standalone world" in out
207
211
assert "key=value" in out
@@ -231,9 +235,13 @@ def test_native_executable_module():
231
235
target_file = os .path .join (tmp_dir , "hello" )
232
236
cmd = [graalpy , "-m" , "standalone" , "--verbose" , "native" , "-Os" , "-m" , module_dir , "-o" , target_file ]
233
237
234
- out = run_cmd (cmd , env )
238
+ out , return_code = run_cmd (cmd , env )
235
239
assert "Bundling Python resources into" in out
236
240
237
241
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
239
247
assert "hello standalone world" in out
0 commit comments