diff options
author | Tim Golden <mail@timgolden.me.uk> | 2010-08-08 11:18:34 (GMT) |
---|---|---|
committer | Tim Golden <mail@timgolden.me.uk> | 2010-08-08 11:18:34 (GMT) |
commit | 10215de1ba09b7608a390aeecbd6cde77c8522f1 (patch) | |
tree | fd674af54240a424343bdf99712b313b1b7c2d7b /Lib/subprocess.py | |
parent | 291430821487e7f3512c1ba769e5044b651f8fc3 (diff) | |
download | cpython-10215de1ba09b7608a390aeecbd6cde77c8522f1.zip cpython-10215de1ba09b7608a390aeecbd6cde77c8522f1.tar.gz cpython-10215de1ba09b7608a390aeecbd6cde77c8522f1.tar.bz2 |
Issue #3210: Revert C module changes and apply patch from Hirokazu Yamamoto instead
Diffstat (limited to 'Lib/subprocess.py')
-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 d19e538..0009bcd 100644 --- a/Lib/subprocess.py +++ b/Lib/subprocess.py @@ -862,6 +862,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 @@ -869,20 +882,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, |