[Python-checkins] CVS: python/dist/src/Modules posixmodule.c,2.146,2.147

Fredrik Lundh python-dev@python.org
Sun, 9 Jul 2000 10:59:34 -0700


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

Modified Files:
	posixmodule.c 
Log Message:


- added popen.popen2/popen3/popen4 support for
  windows.

- added optional mode argument to popen2/popen3
  for unix; if the second argument is an integer,
  it's assumed to be the buffer size.

- changed nt.popen2/popen3/popen4 return values
  to match the popen2 module (stdout first, not
  stdin).



Index: posixmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/posixmodule.c,v
retrieving revision 2.146
retrieving revision 2.147
diff -C2 -r2.146 -r2.147
*** posixmodule.c	2000/07/09 17:41:01	2.146
--- posixmodule.c	2000/07/09 17:59:32	2.147
***************
*** 2150,2154 ****
  posix_popen(PyObject *self, PyObject *args)
  {
- 	int bufsize = -1;
  	PyObject *f, *s;
  	int tm = 0;
--- 2150,2153 ----
***************
*** 2156,2159 ****
--- 2155,2159 ----
  	char *cmdstring;
  	char *mode = "r";
+ 	int bufsize = -1;
  	if (!PyArg_ParseTuple(args, "s|si:popen", &cmdstring, &mode, &bufsize))
  		return NULL;
***************
*** 2175,2181 ****
  
  	if (*(mode+1) == 't')
! 		f = _PyPopen(cmdstring, tm | _O_TEXT , POPEN_1);
  	else if (*(mode+1) == 'b')
! 		f = _PyPopen(cmdstring, tm | _O_BINARY , POPEN_1);
  	else
  		f = _PyPopen(cmdstring, tm | _O_TEXT, POPEN_1);
--- 2175,2181 ----
  
  	if (*(mode+1) == 't')
! 		f = _PyPopen(cmdstring, tm | _O_TEXT, POPEN_1);
  	else if (*(mode+1) == 'b')
! 		f = _PyPopen(cmdstring, tm | _O_BINARY, POPEN_1);
  	else
  		f = _PyPopen(cmdstring, tm | _O_TEXT, POPEN_1);
***************
*** 2222,2228 ****
  /*
   * Variation on <om win32pipe.popen>
   * The result of this function is 3 pipes - the process's stdin,
   * stdout and stderr
-  *
   */
  
--- 2222,2228 ----
  /*
   * Variation on <om win32pipe.popen>
+  *
   * The result of this function is 3 pipes - the process's stdin,
   * stdout and stderr
   */
  
***************
*** 2289,2293 ****
  	}
  
! 	f = _PyPopen(cmdstring, tm , POPEN_4);
  
  	return f;
--- 2289,2293 ----
  	}
  
! 	f = _PyPopen(cmdstring, tm, POPEN_4);
  
  	return f;
***************
*** 2517,2521 ****
  			 CloseHandle(hChildStderrRdDup);
  
! 		 f = Py_BuildValue("OO",p1,p2);
  		 break;
  	 }
--- 2517,2521 ----
  			 CloseHandle(hChildStderrRdDup);
  
! 		 f = Py_BuildValue("OO",p2,p1);
  		 break;
  	 }
***************
*** 2546,2550 ****
  		 PyFile_SetBufSize(p2, 0);
  		 PyFile_SetBufSize(p3, 0);
! 		 f = Py_BuildValue("OOO",p1,p2,p3);
  		 break;
  	 }
--- 2546,2550 ----
  		 PyFile_SetBufSize(p2, 0);
  		 PyFile_SetBufSize(p3, 0);
! 		 f = Py_BuildValue("OOO",p2,p1,p3);
  		 break;
  	 }