diff options
author | Tim Golden <mail@timgolden.me.uk> | 2010-08-08 11:18:16 +0000 |
---|---|---|
committer | Tim Golden <mail@timgolden.me.uk> | 2010-08-08 11:18:16 +0000 |
commit | ad537f23e2e60b92c67fe01855ec1a0a7479df46 (patch) | |
tree | 1d64176388fcd7d512c4b8f106de2d528eb9288f /Lib/subprocess.py | |
parent | afdeca980de5bf1385bce1e7d56a56d75b7b5734 (diff) | |
download | cpython-git-ad537f23e2e60b92c67fe01855ec1a0a7479df46.tar.gz |
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 f8a6342ec5..ae033d4722 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 != -1: + p2cread.Close() + if c2pwrite != -1: + c2pwrite.Close() + if errwrite != -1: + 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 != -1: - p2cread.Close() - if c2pwrite != -1: - c2pwrite.Close() - if errwrite != -1: - errwrite.Close() - - def _internal_poll(self, _deadstate=None, _WaitForSingleObject=_subprocess.WaitForSingleObject, _WAIT_OBJECT_0=_subprocess.WAIT_OBJECT_0, |