*** Lib/subprocess.py 2015-09-13 01:32:39.019021311 +0200 --- Lib/subprocess.py.bak 2015-09-13 01:25:34.542948040 +0200 *************** class Popen(object): *** 679,685 **** self.stdout = None self.stderr = None self.pid = None - self.ppid = None self.returncode = None self.universal_newlines = universal_newlines --- 679,684 ---- *************** class Popen(object): *** 760,770 **** # We didn't get to successfully create a child process. return # In case the child hasn't been waited on, check if it's done. ! try: ! self._internal_poll(_deadstate=_maxint) ! except OSError as e: ! if e.errno != errno.ECHILD: ! raise if self.returncode is None and _active is not None: # Child is still running, keep us alive until we can wait on it. _active.append(self) --- 759,765 ---- # We didn't get to successfully create a child process. return # In case the child hasn't been waited on, check if it's done. ! self._internal_poll(_deadstate=_maxint) if self.returncode is None and _active is not None: # Child is still running, keep us alive until we can wait on it. _active.append(self) *************** class Popen(object): *** 985,991 **** self._child_created = True self._handle = hp self.pid = pid - self.ppid = os.getpid() ht.Close() def _internal_poll(self, _deadstate=None, --- 980,985 ---- *************** class Popen(object): *** 1240,1246 **** gc.enable() raise self._child_created = True - self.ppid = os.getpid() if self.pid == 0: # Child try: --- 1234,1239 ---- *************** class Popen(object): *** 1379,1392 **** # disabled for our process. This child is dead, we # can't get the status. # http://bugs.python.org/issue15756 - # - # This also happens when the waiting process is not the - # parent process -- we check for this here. Note that - # this does not cover wait for pids in a spawned process - # group -- so exclude waits on a negative pid (which - # should never happen anyway) - if (self.pid) > 0 and (self.ppid != os.getpid()): - raise self.returncode = 0 return self.returncode --- 1372,1377 ---- *************** class Popen(object): *** 1403,1416 **** # This happens if SIGCLD is set to be ignored or waiting # for child processes has otherwise been disabled for our # process. This child is dead, we can't get the status. - # - # This also happens when the waiting process is not the - # parent process -- we check for this here. Note that - # this does not cover wait for pids in a spawned process - # group -- so exclude waits on a negative pid (which - # should never happen anyway) - if (self.pid) > 0 and (self.ppid != os.getpid()): - raise pid = self.pid sts = 0 # Check the pid and loop as waitpid has been known to return --- 1388,1393 ----