[Python-checkins] CVS: python/dist/src/Modules posixmodule.c,2.196,2.197
Tim Peters
tim_one@users.sourceforge.net
Sun, 26 Aug 2001 23:37:50 -0700
Update of /cvsroot/python/python/dist/src/Modules
In directory usw-pr-cvs1:/tmp/cvs-serv17006/python/Modules
Modified Files:
posixmodule.c
Log Message:
SF patch [ #455137 ] Makes popen work with COMMAND.COM on WNT, from
Brian Quinlan.
Index: posixmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/posixmodule.c,v
retrieving revision 2.196
retrieving revision 2.197
diff -C2 -d -r2.196 -r2.197
*** posixmodule.c 2001/08/18 18:52:10 2.196
--- posixmodule.c 2001/08/27 06:37:48 2.197
***************
*** 2404,2414 ****
if (i = GetEnvironmentVariable("COMSPEC",NULL,0)) {
s1 = (char *)_alloca(i);
if (!(x = GetEnvironmentVariable("COMSPEC", s1, i)))
return x;
! if (GetVersion() < 0x80000000) {
! /*
! * NT/2000
! */
x = i + strlen(s3) + strlen(cmdstring) + 1;
s2 = (char *)_alloca(x);
--- 2404,2424 ----
if (i = GetEnvironmentVariable("COMSPEC",NULL,0)) {
+ char *comshell;
+
s1 = (char *)_alloca(i);
if (!(x = GetEnvironmentVariable("COMSPEC", s1, i)))
return x;
!
! /* Explicitly check if we are using COMMAND.COM. If we are
! * then use the w9xpopen hack.
! */
! comshell = s1 + x;
! while (comshell >= s1 && *comshell != '\\')
! --comshell;
! ++comshell;
!
! if (GetVersion() < 0x80000000 &&
! _stricmp(comshell, "command.com") != 0) {
! /* NT/2000 and not using command.com. */
x = i + strlen(s3) + strlen(cmdstring) + 1;
s2 = (char *)_alloca(x);
***************
*** 2418,2423 ****
else {
/*
! * Oh gag, we're on Win9x. Use the workaround listed in
! * KB: Q150956
*/
char modulepath[_MAX_PATH];
--- 2428,2433 ----
else {
/*
! * Oh gag, we're on Win9x or using COMMAND.COM. Use
! * the workaround listed in KB: Q150956
*/
char modulepath[_MAX_PATH];
***************
*** 2455,2459 ****
PyErr_Format(PyExc_RuntimeError,
"Can not locate '%s' which is needed "
! "for popen to work on this platform.",
szConsoleSpawn);
return FALSE;
--- 2465,2470 ----
PyErr_Format(PyExc_RuntimeError,
"Can not locate '%s' which is needed "
! "for popen to work with your shell "
! "or platform.",
szConsoleSpawn);
return FALSE;
***************
*** 2479,2483 ****
Now we'll just error out.. */
else {
! PyErr_SetString(PyExc_RuntimeError, "Can not locate a COMSPEC environment variable to use as the shell");
return FALSE;
}
--- 2490,2496 ----
Now we'll just error out.. */
else {
! PyErr_SetString(PyExc_RuntimeError,
! "Cannot locate a COMSPEC environment variable to "
! "use as the shell");
return FALSE;
}
***************
*** 2508,2512 ****
return TRUE;
}
! win32_error("CreateProcess", NULL);
return FALSE;
}
--- 2521,2525 ----
return TRUE;
}
! win32_error("CreateProcess", s2);
return FALSE;
}