diff options
author | Jukka Jylänki <jujjyl@gmail.com> | 2012-11-14 08:46:37 +0200 |
---|---|---|
committer | Jukka Jylänki <jujjyl@gmail.com> | 2012-11-14 08:50:11 +0200 |
commit | e20dbc1074a36da62080e936f61f0c2719638f2e (patch) | |
tree | 0c8760d5c023741c91ef69b4099de984bac23561 /tools | |
parent | 3b249f828977f0295f313f80ba1191f705b44f07 (diff) |
Implement missing used functions on MockPopen to pass Windows tests utilizing timeout_run().
Diffstat (limited to 'tools')
-rw-r--r-- | tools/shared.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/tools/shared.py b/tools/shared.py index 69a2877b..9f170a58 100644 --- a/tools/shared.py +++ b/tools/shared.py @@ -9,6 +9,10 @@ class MockPopen: self.output = (stdout, stderr) def communicate(self): return self.output + def poll(self): + return self.returncode + def kill(self): + return # We've already communicate()d the process (waited for its completion), so can't kill() anymore. Therefore this is a no-op. # 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. # 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 output = process.communicate() # If caller never wanted to PIPE stdout or stderr, route the output back to screen to avoid swallowing output. - if stdout == None and stdout_ == PIPE: + if stdout == None and stdout_ == PIPE and len(output[0].strip()) > 0: print >> sys.stdout, output[0] - if stderr == None and stderr_ == PIPE: + if stderr == None and stderr_ == PIPE and len(output[1].strip()) > 0: print >> sys.stderr, output[1] # Return a mock object to the caller. This works as long as all emscripten code immediately .communicate()s the result, and doesn't |