From: Guido van Rossum Date: Mon, 2 Jun 2003 19:12:01 +0000 (+0000) Subject: When a previous call to poll() has already seen the process status, X-Git-Tag: v2.3c1~540 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3800ef7ae2391e3bf6573b41fc6ac513cd3dde82;p=python When a previous call to poll() has already seen the process status, wait() should not call waitpid() again. Should be backported to 2.2.4. --- diff --git a/Lib/popen2.py b/Lib/popen2.py index d6ff002a20..8a176412f3 100644 --- a/Lib/popen2.py +++ b/Lib/popen2.py @@ -83,10 +83,11 @@ class Popen3: def wait(self): """Wait for and return the exit status of the child process.""" - pid, sts = os.waitpid(self.pid, 0) - if pid == self.pid: - self.sts = sts - _active.remove(self) + if self.sts < 0: + pid, sts = os.waitpid(self.pid, 0) + if pid == self.pid: + self.sts = sts + _active.remove(self) return self.sts