Commit e23fb41a authored by Denis Bilenko's avatar Denis Bilenko

Fix issue #148

read() in small chunks, as reading in big chunks from non-blocking fd
fails on Mac OS X.

Do os._exit() in "finally" section, to avoid raising an exception and thus
executing unrelated code of the main process.

Original patch by Vitaly Kruglikov.
parent b5792409
......@@ -688,9 +688,10 @@ class Popen(object):
exc_value.child_traceback = ''.join(exc_lines)
os.write(errpipe_write, pickle.dumps(exc_value))
# This exitcode won't be reported to applications, so it
# really doesn't matter what we return.
os._exit(255)
finally:
# This exitcode won't be reported to applications, so it
# really doesn't matter what we return.
os._exit(255)
# Parent
self._watcher = self._loop.child(self.pid)
......@@ -710,9 +711,8 @@ class Popen(object):
os.close(errwrite)
# Wait for exec to fail or succeed; possibly raising exception
# Exception limited to 1M
errpipe_read = FileObject(errpipe_read, 'rb')
data = errpipe_read.read(1048576)
data = errpipe_read.read()
finally:
if hasattr(errpipe_read, 'close'):
errpipe_read.close()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment