diff options
author | Gurusamy Sarathy <gsar@cpan.org> | 1999-05-27 03:56:20 +0000 |
---|---|---|
committer | Gurusamy Sarathy <gsar@cpan.org> | 1999-05-27 03:56:20 +0000 |
commit | 3ffaa9377e33221d8a6272d0232e8830ba4312ca (patch) | |
tree | 8636685febb30ff6dcc0053f678c266733c87d8d /win32 | |
parent | df31f264f6de992fe591486e92ee6837dd41cbed (diff) | |
download | perl-3ffaa9377e33221d8a6272d0232e8830ba4312ca.tar.gz |
make win32_spawnvp() inherit standard handles even when they
may be redirected
p4raw-id: //depot/perl@3487
Diffstat (limited to 'win32')
-rw-r--r-- | win32/win32.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/win32/win32.c b/win32/win32.c index f4c7006590..9361191ec0 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -2364,7 +2364,23 @@ win32_spawnvp(int mode, const char *cmdname, const char *const *argv) } memset(&StartupInfo,0,sizeof(StartupInfo)); StartupInfo.cb = sizeof(StartupInfo); - StartupInfo.wShowWindow = SW_SHOWDEFAULT; + StartupInfo.hStdInput = GetStdHandle(STD_INPUT_HANDLE); + StartupInfo.hStdOutput = GetStdHandle(STD_OUTPUT_HANDLE); + StartupInfo.hStdError = GetStdHandle(STD_ERROR_HANDLE); + if (StartupInfo.hStdInput != INVALID_HANDLE_VALUE && + StartupInfo.hStdOutput != INVALID_HANDLE_VALUE && + StartupInfo.hStdError != INVALID_HANDLE_VALUE) + { + StartupInfo.dwFlags |= STARTF_USESTDHANDLES; + } + else { + create |= CREATE_NEW_CONSOLE; + } + +#ifndef DEBUGGING + StartupInfo.dwFlags |= STARTF_USESHOWWINDOW; + StartupInfo.wShowWindow = SW_HIDE; +#endif RETRY: if (!CreateProcess(cmdname, /* search PATH to find executable */ |