cvs: TSRM(PHP_5_3) / tsrm_win32.c

"Pierre-Alain Joye" <[email protected]> Tue, 09 Jun 2009 00:24:31 -0000
Newsgroups gmane.comp.php.cvs.zend
Message-ID <cvspajoye1244507071@cvsserver>
pajoye		Tue Jun  9 00:24:31 2009 UTC

  Modified files:              (Branch: PHP_5_3)
    /TSRM	tsrm_win32.c 
  Log:
   #41874, separate STDOUT and STDERR in exec functions
  
http://cvs.php.net/viewvc.cgi/TSRM/tsrm_win32.c?r1=1.27.2.1.2.7.2.7&r2=1.27.2.1.2.7.2.8&diff_format=u
Index: TSRM/tsrm_win32.c
diff -u TSRM/tsrm_win32.c:1.27.2.1.2.7.2.7 TSRM/tsrm_win32.c:1.27.2.1.2.7.2.8
--- TSRM/tsrm_win32.c:1.27.2.1.2.7.2.7	Tue May 19 10:00:12 2009
+++ TSRM/tsrm_win32.c	Tue Jun  9 00:24:31 2009
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: tsrm_win32.c,v 1.27.2.1.2.7.2.7 2009/05/19 10:00:12 bjori Exp $ */
+/* $Id: tsrm_win32.c,v 1.27.2.1.2.7.2.8 2009/06/09 00:24:31 pajoye Exp $ */
 
 #include <stdio.h>
 #include <fcntl.h>
@@ -251,6 +251,7 @@
 	PROCESS_INFORMATION process;
 	SECURITY_ATTRIBUTES security;
 	HANDLE in, out;
+	DWORD dwCreateFlags = 0;
 	char *cmd;
 	process_pair *proc;
 	TSRMLS_FETCH();
@@ -273,7 +274,6 @@
 	read = (type[0] == 'r') ? TRUE : FALSE;
 	mode = ((str_len == 2) && (type[1] == 'b')) ? O_BINARY : O_TEXT;
 
-
 	if (read) {
 		in = dupHandle(in, FALSE);
 		startup.hStdInput  = GetStdHandle(STD_INPUT_HANDLE);
@@ -284,9 +284,14 @@
 		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);



-- 
Zend Engine CVS Mailing List (http://cvs.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php