diff options
author | Gregory P. Smith <greg@krypto.org> | 2017-01-23 01:29:44 (GMT) |
---|---|---|
committer | Gregory P. Smith <greg@krypto.org> | 2017-01-23 01:29:44 (GMT) |
commit | 78034c81fb0f5b82845533e215f7e5686ce88964 (patch) | |
tree | 006793f296a6f98d4e9c7707b2cfb7d0034532bf /Lib/subprocess.py | |
parent | b1681189af1157d9b6161c8a3a645c2eb816b415 (diff) | |
parent | 50e16e33af69aca6e908bace793178c8d6ab8272 (diff) | |
download | cpython-78034c81fb0f5b82845533e215f7e5686ce88964.zip cpython-78034c81fb0f5b82845533e215f7e5686ce88964.tar.gz cpython-78034c81fb0f5b82845533e215f7e5686ce88964.tar.bz2 |
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.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Lib/subprocess.py b/Lib/subprocess.py index 13b9d44..822ddb4 100644 --- a/Lib/subprocess.py +++ b/Lib/subprocess.py @@ -1329,7 +1329,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. @@ -1337,6 +1338,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!") |