Bug 421751: make nsIProcess.run() not open any console windows on Windows. r=dougt, sr=mconnor, a=damons
authorthunder@mozilla.com
Wed, 12 Mar 2008 14:03:08 -0700
changeset 12963 66fa75e89b58f459414962352f4c908c33caec29
parent 12962 9c60039bfe989c9fe1736520ea32ced16dab0b86
child 12964 cd598cbaac46476a1ece0a59b6efa2613001fc90
push idunknown
push userunknown
push dateunknown
reviewersdougt, mconnor, damons
bugs421751
milestone1.9b5pre
Bug 421751: make nsIProcess.run() not open any console windows on Windows. r=dougt, sr=mconnor, a=damons
xpcom/threads/nsProcessCommon.cpp
--- a/xpcom/threads/nsProcessCommon.cpp
+++ b/xpcom/threads/nsProcessCommon.cpp
@@ -245,25 +245,31 @@ nsProcess::Run(PRBool blocking, const ch
     if (assembleCmdLine(my_argv, &cmdLine) == -1) {
         nsMemory::Free(my_argv);
         return NS_ERROR_FILE_EXECUTION_FAILED;    
     }
 
     ZeroMemory(&startupInfo, sizeof(startupInfo));
     startupInfo.cb = sizeof(startupInfo);
 
+    /* The CREATE_NO_WINDOW flag is important to prevent console
+     * windows from appearing.  This makes behavior the same on all
+     * platforms.  This won't work on win9x, however.  The flag will
+     * not have any effect on non-console applications.
+     */
+
     retVal = CreateProcess(NULL,
                            // const_cast<char*>(mTargetPath.get()),
                            cmdLine,
                            NULL,  /* security attributes for the new
                                    * process */
                            NULL,  /* security attributes for the primary
                                    * thread in the new process */
                            FALSE,  /* inherit handles */
-                           0,     /* creation flags */
+                           CREATE_NO_WINDOW, /* creation flags */
                            NULL,  /* env */
                            NULL,  /* current drive and directory */
                            &startupInfo,
                            &procInfo
                           );
     PR_Free( cmdLine );
     if (blocking) {