]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Issue #26741: POSIX implementation of subprocess.Popen._execute_child() now
authorVictor Stinner <victor.stinner@gmail.com>
Fri, 20 May 2016 10:08:12 +0000 (12:08 +0200)
committerVictor Stinner <victor.stinner@gmail.com>
Fri, 20 May 2016 10:08:12 +0000 (12:08 +0200)
sets the returncode attribute using the child process exit status when exec
failed.

Lib/subprocess.py

index 642c7f218223c88c650f346932a0eb9e57c15c8d..41a9de10f5efd70eea9c140685c202b267eba3b7 100644 (file)
@@ -1524,9 +1524,14 @@ class Popen(object):
 
             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))