[Python-checkins] CVS: python/dist/src/Lib popen2.py,1.10,1.11

Fredrik Lundh python-dev@python.org
Sun, 9 Jul 2000 16:35:27 -0700


Update of /cvsroot/python/python/dist/src/Lib
In directory slayer.i.sourceforge.net:/tmp/cvs-serv840/Lib

Modified Files:
	popen2.py 
Log Message:


- changed the nt.popen2 return values back to
  (write, read, ...), based on feedback from GvR.

- added tuple-swapping code to popen2.py

- fixed some runaway indentation in posixmodule.c

Index: popen2.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/popen2.py,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -r1.10 -r1.11
*** popen2.py	2000/07/09 17:59:31	1.10
--- popen2.py	2000/07/09 23:35:24	1.11
***************
*** 90,100 ****
          return self.sts
  
! try:
!     from os import popen2
! except NameError:
      def popen2(cmd, mode='t', bufsize=-1):
          """Execute the shell command 'cmd' in a sub-process.  If 'bufsize' is
          specified, it sets the buffer size for the I/O pipes.  The file objects
          (child_stdout, child_stdin) are returned."""
          if type(mode) is type(0) and bufsize == -1:
              bufsize = mode
--- 90,105 ----
          return self.sts
  
! if hasattr(os, "popen2"):
      def popen2(cmd, mode='t', bufsize=-1):
          """Execute the shell command 'cmd' in a sub-process.  If 'bufsize' is
          specified, it sets the buffer size for the I/O pipes.  The file objects
          (child_stdout, child_stdin) are returned."""
+         w, r = os.popen2(cmd, mode, bufsize)
+         return r, w
+ else:
+     def popen2(cmd, mode='t', bufsize=-1):
+         """Execute the shell command 'cmd' in a sub-process.  If 'bufsize' is
+         specified, it sets the buffer size for the I/O pipes.  The file objects
+         (child_stdout, child_stdin) are returned."""
          if type(mode) is type(0) and bufsize == -1:
              bufsize = mode
***************
*** 105,111 ****
          return inst.fromchild, inst.tochild
  
! try:
!     from os import popen3
! except NameError:
      def popen3(cmd, mode='t', bufsize=-1):
          """Execute the shell command 'cmd' in a sub-process.  If 'bufsize' is
--- 110,121 ----
          return inst.fromchild, inst.tochild
  
! if hasattr(os, "popen3"):
!     def popen3(cmd, mode='t', bufsize=-1):
!         """Execute the shell command 'cmd' in a sub-process.  If 'bufsize' is
!         specified, it sets the buffer size for the I/O pipes.  The file objects
!         (child_stdout, child_stdin, child_stderr) are returned."""
!         w, r, e = os.popen3(cmd, mode, bufsize)
!         return r, w, e
! else:
      def popen3(cmd, mode='t', bufsize=-1):
          """Execute the shell command 'cmd' in a sub-process.  If 'bufsize' is
***************
*** 120,127 ****
          return inst.fromchild, inst.tochild, inst.childerr
  
! try:
!     from os import popen4
! except NameError:
!     pass # not on unix
  
  def _test():
--- 130,142 ----
          return inst.fromchild, inst.tochild, inst.childerr
  
! if hasattr(os, "popen4"):
!     def popen4(cmd, mode='t', bufsize=-1):
!         """Execute the shell command 'cmd' in a sub-process.  If 'bufsize' is
!         specified, it sets the buffer size for the I/O pipes.  The file objects
!         (child_stdout_stderr, child_stdin) are returned."""
!         w, r = os.popen4(cmd, mode, bufsize)
!         return r, w
! else:
!     pass # not yet on unix
  
  def _test():