another windows fix: only create a new console for subprocesses
authorGurusamy Sarathy <gsar@cpan.org>
Mon, 22 Apr 2002 07:02:03 +0000 (07:02 +0000)
committerGurusamy Sarathy <gsar@cpan.org>
Mon, 22 Apr 2002 07:02:03 +0000 (07:02 +0000)
when all three stdhandles are invalid (from Jan Dubois)

p4raw-id: //depot/perl@16062

win32/win32.c

index 28619fd..ba8c637 100644 (file)
@@ -3727,14 +3727,14 @@ win32_spawnvp(int mode, const char *cmdname, const char *const *argv)
     StartupInfo.hStdInput      = tbl.childStdIn;
     StartupInfo.hStdOutput     = tbl.childStdOut;
     StartupInfo.hStdError      = tbl.childStdErr;
-    if (StartupInfo.hStdInput != INVALID_HANDLE_VALUE &&
-       StartupInfo.hStdOutput != INVALID_HANDLE_VALUE &&
-       StartupInfo.hStdError != INVALID_HANDLE_VALUE)
+    if (StartupInfo.hStdInput == INVALID_HANDLE_VALUE &&
+       StartupInfo.hStdOutput == INVALID_HANDLE_VALUE &&
+       StartupInfo.hStdError == INVALID_HANDLE_VALUE)
     {
-       StartupInfo.dwFlags |= STARTF_USESTDHANDLES;
+       create |= CREATE_NEW_CONSOLE;
     }
     else {
-       create |= CREATE_NEW_CONSOLE;
+       StartupInfo.dwFlags |= STARTF_USESTDHANDLES;
     }
     if (w32_use_showwindow) {
         StartupInfo.dwFlags |= STARTF_USESHOWWINDOW;