[Python-checkins] cpython: Issue #26741: POSIX implementation of subprocess.Popen._execute_child() now

victor.stinner python-checkins at python.org
Fri May 20 06:48:07 EDT 2016


https://hg.python.org/cpython/rev/4c02b983bd5f
changeset:   101445:4c02b983bd5f
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Fri May 20 12:08:12 2016 +0200
summary:
  Issue #26741: POSIX implementation of subprocess.Popen._execute_child() now
sets the returncode attribute using the child process exit status when exec
failed.

files:
  Lib/subprocess.py |  7 ++++++-
  1 files changed, 6 insertions(+), 1 deletions(-)


diff --git a/Lib/subprocess.py b/Lib/subprocess.py
--- a/Lib/subprocess.py
+++ b/Lib/subprocess.py
@@ -1524,9 +1524,14 @@
 
             if errpipe_data:
                 try:
-                    os.waitpid(self.pid, 0)
+                    pid, sts = os.waitpid(self.pid, 0)
+                    if pid == self.pid:
+                        self._handle_exitstatus(sts)
+                    else:
+                        self.returncode = sys.maxsize
                 except ChildProcessError:
                     pass
+
                 try:
                     exception_name, hex_errno, err_msg = (
                             errpipe_data.split(b':', 2))

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list