diff options
| author | Gregory P. Smith <greg@krypto.org> | 2012-09-29 11:53:08 -0700 |
|---|---|---|
| committer | Gregory P. Smith <greg@krypto.org> | 2012-09-29 11:53:08 -0700 |
| commit | d30bbe13d46a6d8faead668919cd7bed3b88f068 (patch) | |
| tree | 9b6d104fbdbb3e61668d8011b080fc87d53913fb /Lib/subprocess.py | |
| parent | 8661f614124c06b6adc2e5e4a85cc9c3a92cf75e (diff) | |
| parent | 455e4bfe1ce794225530bc10671c86346d0025b5 (diff) | |
| download | cpython-d30bbe13d46a6d8faead668919cd7bed3b88f068.tar.gz | |
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.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/Lib/subprocess.py b/Lib/subprocess.py index cec1a24fee..775db501a1 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 |
