From a9d85b668cc2192f0e2f6f08cd76882516b1331e Mon Sep 17 00:00:00 2001 From: Pierre Joye Date: Tue, 9 Jun 2009 14:05:44 +0000 Subject: [PATCH] - #41874, separate STDOUT and STDERR in exec functions --- TSRM/tsrm_win32.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/TSRM/tsrm_win32.c b/TSRM/tsrm_win32.c index 33559a50e9..ae18f39ec2 100644 --- a/TSRM/tsrm_win32.c +++ b/TSRM/tsrm_win32.c @@ -27,6 +27,7 @@ #define TSRM_INCLUDE_FULL_WINDOWS_HEADERS +#include "SAPI.h" #include "TSRM.h" #ifdef TSRM_WIN32 @@ -251,6 +252,7 @@ TSRM_API FILE *popen_ex(const char *command, const char *type, const char *cwd, PROCESS_INFORMATION process; SECURITY_ATTRIBUTES security; HANDLE in, out; + DWORD dwCreateFlags = 0; char *cmd; process_pair *proc; TSRMLS_FETCH(); @@ -284,9 +286,14 @@ TSRM_API FILE *popen_ex(const char *command, const char *type, const char *cwd, startup.hStdOutput = GetStdHandle(STD_OUTPUT_HANDLE); } + dwCreateFlags = NORMAL_PRIORITY_CLASS; + if (strcmp(sapi_module.name, "cli") != 0) { + dwCreateFlags |= CREATE_NO_WINDOW; + } + cmd = (char*)malloc(strlen(command)+strlen(TWG(comspec))+sizeof(" /c ")+2); sprintf(cmd, "%s /c \"%s\"", TWG(comspec), command); - if (!CreateProcess(NULL, cmd, &security, &security, security.bInheritHandle, NORMAL_PRIORITY_CLASS|CREATE_NO_WINDOW, env, cwd, &startup, &process)) { + if (!CreateProcess(NULL, cmd, &security, &security, security.bInheritHandle, dwCreateFlags, env, cwd, &startup, &process)) { return NULL; } free(cmd); -- 2.40.0