From: Pierre Joye Date: Tue, 9 Jun 2009 14:05:44 +0000 (+0000) Subject: - #41874, separate STDOUT and STDERR in exec functions X-Git-Tag: php-5.4.0alpha1~191^2~3374 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a9d85b668cc2192f0e2f6f08cd76882516b1331e;p=php - #41874, separate STDOUT and STDERR in exec functions --- 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);