summaryrefslogtreecommitdiffstats
path: root/Lib/subprocess.py
diff options
context:
space:
mode:
authorGregory P. Smith <greg@krypto.org>2012-09-29 18:53:08 (GMT)
committerGregory P. Smith <greg@krypto.org>2012-09-29 18:53:08 (GMT)
commit02dee1acd8d905a2348e5ed4d9f97cb490e5e255 (patch)
tree36841ec3c83b8a590a9908b783613c9c28c64d48 /Lib/subprocess.py
parentcff1c6f66555ced39ab8c5cff61a0872015dee7a (diff)
parent3905171f1ea778c60c74dd4b0318b894eda94d7f (diff)
downloadcpython-02dee1acd8d905a2348e5ed4d9f97cb490e5e255.zip
cpython-02dee1acd8d905a2348e5ed4d9f97cb490e5e255.tar.gz
cpython-02dee1acd8d905a2348e5ed4d9f97cb490e5e255.tar.bz2
Fixes 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 cec1a24..775db50 100644
--- a/Lib/subprocess.py
+++ b/Lib/subprocess.py
@@ -1445,9 +1445,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
+ elif 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