[Python-checkins] CVS: python/dist/src/Lib os.py,1.36,1.37 popen2.py,1.13,1.14

Fred L. Drake python-dev@python.org
Mon, 28 Aug 2000 10:20:08 -0700


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

Modified Files:
	os.py popen2.py 
Log Message:

Added os.popen2() and os.popen3() for non-Windows platforms.


Index: os.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/os.py,v
retrieving revision 1.36
retrieving revision 1.37
diff -C2 -r1.36 -r1.37
*** os.py	2000/07/25 15:16:40	1.36
--- os.py	2000/08/28 17:20:04	1.37
***************
*** 455,456 ****
--- 455,469 ----
  
  
+ if not _exists("popen2"):
+     def popen2(cmd, mode="t", bufsize=-1):
+         assert mode[:1] in ("b", "t")
+         import popen2
+         stdout, stdin = popen2.popen2(cmd, bufsize)
+         return stdin, stdout
+ 
+ if not _exists("popen3"):
+     def popen3(cmd, mode="t", bufsize=-1):
+         assert mode[:1] in ("b", "t")
+         import popen2
+         stdout, stdin, stderr = popen2.popen3(cmd, bufsize)
+         return stdin, stdout, stderr

Index: popen2.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/popen2.py,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -r1.13 -r1.14
*** popen2.py	2000/08/20 05:57:36	1.13
--- popen2.py	2000/08/28 17:20:04	1.14
***************
*** 90,94 ****
          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
--- 90,95 ----
          return self.sts
  
! 
! if sys.platform[:3] == "win":
      def popen2(cmd, mode='t', bufsize=-1):
          """Execute the shell command 'cmd' in a sub-process.  If 'bufsize' is
***************
*** 110,114 ****
          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
--- 111,115 ----
          return inst.fromchild, inst.tochild
  
! if sys.platform[:3] == "win":
      def popen3(cmd, mode='t', bufsize=-1):
          """Execute the shell command 'cmd' in a sub-process.  If 'bufsize' is
***************
*** 130,134 ****
          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
--- 131,135 ----
          return inst.fromchild, inst.tochild, inst.childerr
  
! if sys.platform[:3] == "win":
      def popen4(cmd, mode='t', bufsize=-1):
          """Execute the shell command 'cmd' in a sub-process.  If 'bufsize' is
***************
*** 139,142 ****
--- 140,144 ----
  else:
      pass # not yet on unix
+ 
  
  def _test():