diff options
author | Tim Golden <mail@timgolden.me.uk> | 2010-08-08 11:17:56 (GMT) |
---|---|---|
committer | Tim Golden <mail@timgolden.me.uk> | 2010-08-08 11:17:56 (GMT) |
commit | 431774f32a22a4bdfc5a239709bcba3e8d7045e9 (patch) | |
tree | 61a4094611d7d1e24eb726dded348368c3b81c95 /Lib | |
parent | 3de8a305004f465d8c8967862a1a6251cb2ff375 (diff) | |
download | cpython-431774f32a22a4bdfc5a239709bcba3e8d7045e9.zip cpython-431774f32a22a4bdfc5a239709bcba3e8d7045e9.tar.gz cpython-431774f32a22a4bdfc5a239709bcba3e8d7045e9.tar.bz2 |
Issue #3210: Revert C module changes and apply patch from Hirokazu Yamamoto instead
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/subprocess.py | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/Lib/subprocess.py b/Lib/subprocess.py index 3cd8e90..395b7a3 100644 --- a/Lib/subprocess.py +++ b/Lib/subprocess.py @@ -886,6 +886,19 @@ class Popen(object): # translate errno using _sys_errlist (or simliar), but # how can this be done from Python? raise WindowsError(*e.args) + finally: + # Child is launched. Close the parent's copy of those pipe + # handles that only the child should have open. You need + # to make sure that no handles to the write end of the + # output pipe are maintained in this process or else the + # pipe will not close when the child process exits and the + # ReadFile will hang. + if p2cread is not None: + p2cread.Close() + if c2pwrite is not None: + c2pwrite.Close() + if errwrite is not None: + errwrite.Close() # Retain the process handle, but close the thread handle self._child_created = True @@ -893,20 +906,6 @@ class Popen(object): self.pid = pid ht.Close() - # Child is launched. Close the parent's copy of those pipe - # handles that only the child should have open. You need - # to make sure that no handles to the write end of the - # output pipe are maintained in this process or else the - # pipe will not close when the child process exits and the - # ReadFile will hang. - if p2cread is not None: - p2cread.Close() - if c2pwrite is not None: - c2pwrite.Close() - if errwrite is not None: - errwrite.Close() - - def _internal_poll(self, _deadstate=None, _WaitForSingleObject=_subprocess.WaitForSingleObject, _WAIT_OBJECT_0=_subprocess.WAIT_OBJECT_0, |