]> granicus.if.org Git - python/commitdiff
When a previous call to poll() has already seen the process status,
authorGuido van Rossum <guido@python.org>
Mon, 2 Jun 2003 19:12:01 +0000 (19:12 +0000)
committerGuido van Rossum <guido@python.org>
Mon, 2 Jun 2003 19:12:01 +0000 (19:12 +0000)
wait() should not call waitpid() again.

Should be backported to 2.2.4.

Lib/popen2.py

index d6ff002a20c31a5fb78748a24583e6c599d58430..8a176412f305e9efc25f3b27dcfe27fe73fdfe1b 100644 (file)
@@ -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