X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b481194f519028fb10aa436e857c015eb253d688..364f3b070071ee73e417a3770342d779774288e8:/src/msw/utilsexc.cpp diff --git a/src/msw/utilsexc.cpp b/src/msw/utilsexc.cpp index c2cc31a73b..734ca45d11 100644 --- a/src/msw/utilsexc.cpp +++ b/src/msw/utilsexc.cpp @@ -48,10 +48,8 @@ #if !defined(__GNUWIN32__) && !defined(__WXMICROWIN__) && !defined(__WXWINCE__) #include -#ifndef __MWERKS__ #include #endif -#endif #if defined(__GNUWIN32__) #include @@ -755,15 +753,6 @@ long wxExecute(const wxString& cmd, int flags, wxProcess *handler, si.hStdOutput = pipeOut[wxPipe::Write]; si.hStdError = pipeErr[wxPipe::Write]; - // when the std IO is redirected, we don't show the (console) process - // window by default, but this can be overridden by the caller by - // specifying wxEXEC_NOHIDE flag - if ( !(flags & wxEXEC_NOHIDE) ) - { - si.dwFlags |= STARTF_USESHOWWINDOW; - si.wShowWindow = SW_HIDE; - } - // we must duplicate the handle to the write side of stdin pipe to make // it non inheritable: indeed, we must close the writing end of pipeIn // before launching the child process as otherwise this handle will be @@ -788,10 +777,25 @@ long wxExecute(const wxString& cmd, int flags, wxProcess *handler, } #endif // wxUSE_STREAMS + // The default logic for showing the console is to show it only if the IO + // is not redirected however wxEXEC_{SHOW,HIDE}_CONSOLE flags can be + // explicitly specified to change it. + if ( (flags & wxEXEC_HIDE_CONSOLE) || + (redirect && !(flags & wxEXEC_SHOW_CONSOLE)) ) + { + si.dwFlags |= STARTF_USESHOWWINDOW; + si.wShowWindow = SW_HIDE; + } + + PROCESS_INFORMATION pi; DWORD dwFlags = CREATE_SUSPENDED; #ifndef __WXWINCE__ + if ( (flags & wxEXEC_MAKE_GROUP_LEADER) && + (wxGetOsVersion() == wxOS_WINDOWS_NT) ) + dwFlags |= CREATE_NEW_PROCESS_GROUP; + dwFlags |= CREATE_DEFAULT_ERROR_MODE ; #else // we are assuming commands without spaces for now