summaryrefslogtreecommitdiff
path: root/ext/standard/proc_open.c
diff options
context:
space:
mode:
authorPierre Joye <pajoye@php.net>2009-06-09 00:25:37 +0000
committerPierre Joye <pajoye@php.net>2009-06-09 00:25:37 +0000
commit49666eece6b8d5de74f1bae2537e8cc3919203ee (patch)
tree9db4dc2f65883dda286b4c2a048da82c1601e15d /ext/standard/proc_open.c
parentc59a4a0173adf192ff3fc89310357b529fdc39f5 (diff)
downloadphp-git-49666eece6b8d5de74f1bae2537e8cc3919203ee.tar.gz
#41874, separate STDOUT and STDERR in exec functions
Diffstat (limited to 'ext/standard/proc_open.c')
-rw-r--r--ext/standard/proc_open.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/ext/standard/proc_open.c b/ext/standard/proc_open.c
index b7f6c67fb8..584d175a43 100644
--- a/ext/standard/proc_open.c
+++ b/ext/standard/proc_open.c
@@ -483,6 +483,7 @@ PHP_FUNCTION(proc_open)
STARTUPINFO si;
BOOL newprocok;
SECURITY_ATTRIBUTES security;
+ DWORD dwCreateFlags = 0;
char *command_with_cmd;
UINT old_error_mode;
#endif
@@ -754,12 +755,17 @@ PHP_FUNCTION(proc_open)
old_error_mode = SetErrorMode(SEM_FAILCRITICALERRORS|SEM_NOGPFAULTERRORBOX);
}
+ dwCreateFlags = NORMAL_PRIORITY_CLASS;
+ if(strcmp(sapi_module.name, "cli") != 0) {
+ dwCreateFlags |= CREATE_NO_WINDOW;
+ }
+
if (bypass_shell) {
- newprocok = CreateProcess(NULL, command, &security, &security, TRUE, NORMAL_PRIORITY_CLASS|CREATE_NO_WINDOW, env.envp, cwd, &si, &pi);
+ newprocok = CreateProcess(NULL, command, &security, &security, TRUE, dwCreateFlags, env.envp, cwd, &si, &pi);
} else {
spprintf(&command_with_cmd, 0, "%s /c %s", GetVersion() < 0x80000000 ? COMSPEC_NT : COMSPEC_9X, command);
- newprocok = CreateProcess(NULL, command_with_cmd, &security, &security, TRUE, NORMAL_PRIORITY_CLASS|CREATE_NO_WINDOW, env.envp, cwd, &si, &pi);
+ newprocok = CreateProcess(NULL, command_with_cmd, &security, &security, TRUE, dwCreateFlags, env.envp, cwd, &si, &pi);
efree(command_with_cmd);
}