cpython: 512c1120332f (original) (raw)
Mercurial > cpython
changeset 80366:512c1120332f
Fixes issue #14396: Handle the odd rare case of waitpid returning 0 when not expected in subprocess.Popen.wait(). [#14396]
Gregory P. Smith greg@krypto.org | |
---|---|
date | Sat, 10 Nov 2012 21:10:31 -0800 |
parents | 41280973921a(current diff)80adde16cc94(diff) |
children | a9e238168588 |
files | Misc/NEWS |
diffstat | 2 files changed, 10 insertions(+), 3 deletions(-)[+] [-] Lib/subprocess.py 10 Misc/NEWS 3 |
line wrap: on
line diff
--- a/Lib/subprocess.py +++ b/Lib/subprocess.py @@ -1509,9 +1509,13 @@ class Popen(object): raise TimeoutExpired(self.args, timeout) delay = min(delay * 2, remaining, .05) time.sleep(delay)
elif self.returncode is None:[](#l1.7)
(pid, sts) = self._try_wait(0)[](#l1.8)
self._handle_exitstatus(sts)[](#l1.9)
else:[](#l1.10)
while self.returncode is None:[](#l1.11)
(pid, sts) = self._try_wait(0)[](#l1.12)
# Check the pid and loop as waitpid has been known to return[](#l1.13)
# 0 even without WNOHANG in odd situations. issue14396.[](#l1.14)
if pid == self.pid:[](#l1.15)
self._handle_exitstatus(sts)[](#l1.16) return self.returncode[](#l1.17)
--- a/Misc/NEWS +++ b/Misc/NEWS @@ -116,6 +116,9 @@ Core and Builtins Library ------- +- Issue #14396: Handle the odd rare case of waitpid returning 0 when not