Issue #26741: POSIX implementation of subprocess.Popen._execute_child() now
sets the returncode attribute using the child process exit status when exec
failed.
diff --git a/Lib/subprocess.py b/Lib/subprocess.py
index 642c7f2..41a9de1 100644
--- 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))