Skip to content

Commit e20dbc1

Browse files
committed
Implement missing used functions on MockPopen to pass Windows tests utilizing timeout_run().
1 parent 3b249f8 commit e20dbc1

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

tools/shared.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ def __init__(self, stdout, stderr, returncode):
99
self.output = (stdout, stderr)
1010
def communicate(self):
1111
return self.output
12+
def poll(self):
13+
return self.returncode
14+
def kill(self):
15+
return # We've already communicate()d the process (waited for its completion), so can't kill() anymore. Therefore this is a no-op.
1216

1317
# On Windows python suffers from a particularly nasty bug if python is spawning new processes while python itself is spawned from some other non-console process.
1418
# Use a custom replacement for Popen on Windows to avoid the "WindowsError: [Error 6] The handle is invalid" errors when emcc is driven through cmake or mingw32-make.
@@ -35,9 +39,9 @@ def call_process(args, bufsize=0, executable=None, stdin=None, stdout=None, stde
3539
output = process.communicate()
3640

3741
# If caller never wanted to PIPE stdout or stderr, route the output back to screen to avoid swallowing output.
38-
if stdout == None and stdout_ == PIPE:
42+
if stdout == None and stdout_ == PIPE and len(output[0].strip()) > 0:
3943
print >> sys.stdout, output[0]
40-
if stderr == None and stderr_ == PIPE:
44+
if stderr == None and stderr_ == PIPE and len(output[1].strip()) > 0:
4145
print >> sys.stderr, output[1]
4246

4347
# Return a mock object to the caller. This works as long as all emscripten code immediately .communicate()s the result, and doesn't

0 commit comments

Comments
 (0)