[Python-checkins] python/dist/src/Lib popen2.py,1.25,1.26

gvanrossum@users.sourceforge.net gvanrossum@users.sourceforge.net
Mon, 02 Jun 2003 12:12:04 -0700


Update of /cvsroot/python/python/dist/src/Lib
In directory sc8-pr-cvs1:/tmp/cvs-serv5743

Modified Files:
	popen2.py 
Log Message:
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.


Index: popen2.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/popen2.py,v
retrieving revision 1.25
retrieving revision 1.26
diff -C2 -d -r1.25 -r1.26
*** popen2.py	3 Jun 2002 15:58:31 -0000	1.25
--- popen2.py	2 Jun 2003 19:12:01 -0000	1.26
***************
*** 84,91 ****
      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)
          return self.sts
  
--- 84,92 ----
      def wait(self):
          """Wait for and return the exit status of the child process."""
!         if self.sts < 0:
!             pid, sts = os.waitpid(self.pid, 0)
!             if pid == self.pid:
!                 self.sts = sts
!                 _active.remove(self)
          return self.sts