src/windows/native/java/lang/ProcessImpl_md.c

Print this page

        

@@ -306,11 +306,15 @@
                     success = initHolder(env, &handles[2], &holderErr, &si.hStdError);
                 }
 
                 if (success) {
                     PROCESS_INFORMATION pi;
-                    DWORD processFlag = CREATE_NO_WINDOW | CREATE_UNICODE_ENVIRONMENT;
+                    DWORD processFlag = CREATE_UNICODE_ENVIRONMENT;
+
+                    /* Suppress popping-up of a console window for non-console applications */
+                    if (GetConsoleWindow() == NULL)
+                        processFlag |= CREATE_NO_WINDOW;
 
                     si.dwFlags = STARTF_USESTDHANDLES;
                     if (!CreateProcessW(
                         NULL,             /* executable name */
                         (LPWSTR)pcmd,     /* command line */