summaryrefslogtreecommitdiff
path: root/Lib/subprocess.py
diff options
context:
space:
mode:
authorGregory P. Smith <greg@krypto.org>2017-01-22 17:30:28 -0800
committerGregory P. Smith <greg@krypto.org>2017-01-22 17:30:28 -0800
commit5c8706c04a90bf4a202970bf1b2d32febefdda4f (patch)
treed3df151a4c2c89f99362d7d9c96353347d30e0f7 /Lib/subprocess.py
parent2a404b63d48d73bbaa007d89efb7a01048475acd (diff)
parent78034c81fb0f5b82845533e215f7e5686ce88964 (diff)
downloadcpython-git-5c8706c04a90bf4a202970bf1b2d32febefdda4f.tar.gz
Issue #29335: Fix subprocess.Popen.wait() when the child process has
exited to a stopped instead of terminated state (ex: when under ptrace).
Diffstat (limited to 'Lib/subprocess.py')
-rw-r--r--Lib/subprocess.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/Lib/subprocess.py b/Lib/subprocess.py
index c4f84d8e8a..67b9c9f1b1 100644
--- a/Lib/subprocess.py
+++ b/Lib/subprocess.py
@@ -1326,7 +1326,8 @@ class Popen(object):
def _handle_exitstatus(self, sts, _WIFSIGNALED=os.WIFSIGNALED,
_WTERMSIG=os.WTERMSIG, _WIFEXITED=os.WIFEXITED,
- _WEXITSTATUS=os.WEXITSTATUS):
+ _WEXITSTATUS=os.WEXITSTATUS, _WIFSTOPPED=os.WIFSTOPPED,
+ _WSTOPSIG=os.WSTOPSIG):
"""All callers to this function MUST hold self._waitpid_lock."""
# This method is called (indirectly) by __del__, so it cannot
# refer to anything outside of its local scope.
@@ -1334,6 +1335,8 @@ class Popen(object):
self.returncode = -_WTERMSIG(sts)
elif _WIFEXITED(sts):
self.returncode = _WEXITSTATUS(sts)
+ elif _WIFSTOPPED(sts):
+ self.returncode = -_WSTOPSIG(sts)
else:
# Should never happen
raise SubprocessError("Unknown child exit status!")