summaryrefslogtreecommitdiff
path: root/Lib/subprocess.py
diff options
context:
space:
mode:
authorGregory P. Smith <greg@krypto.org>2012-09-29 12:02:48 -0700
committerGregory P. Smith <greg@krypto.org>2012-09-29 12:02:48 -0700
commit0798cbc1df56e7e681acac755a59d80a6ff60a9b (patch)
tree7e63689b9c52d5894912f403967ace6faaca180c /Lib/subprocess.py
parent218a8ab5eb6233cab176e69c1109d5b65cd04fbe (diff)
downloadcpython-git-0798cbc1df56e7e681acac755a59d80a6ff60a9b.tar.gz
Issue #15756: subprocess.poll() now properly handles errno.ECHILD to
return a returncode of 0 when the child has already exited or cannot be waited on.
Diffstat (limited to 'Lib/subprocess.py')
-rw-r--r--Lib/subprocess.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/Lib/subprocess.py b/Lib/subprocess.py
index 6cc3fa1312..0f284d1f0d 100644
--- a/Lib/subprocess.py
+++ b/Lib/subprocess.py
@@ -1287,9 +1287,16 @@ class Popen(object):
pid, sts = _waitpid(self.pid, _WNOHANG)
if pid == self.pid:
self._handle_exitstatus(sts)
- except _os_error:
+ except _os_error as e:
if _deadstate is not None:
self.returncode = _deadstate
+ if e.errno == errno.ECHILD:
+ # This happens if SIGCLD is set to be ignored or
+ # waiting for child processes has otherwise been
+ # disabled for our process. This child is dead, we
+ # can't get the status.
+ # http://bugs.python.org/issue15756
+ self.returncode = 0
return self.returncode