X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/27d2dbbccadf25bb1d892fe1c4afbf74cf76bb36..df21986cb7d7d33a8c28a2c60930532a7a53233c:/src/msw/utilsexc.cpp?ds=sidebyside diff --git a/src/msw/utilsexc.cpp b/src/msw/utilsexc.cpp index ecdb0f9792..226677c279 100644 --- a/src/msw/utilsexc.cpp +++ b/src/msw/utilsexc.cpp @@ -179,7 +179,8 @@ class wxPipeOutputStream: public wxOutputStream { public: wxPipeOutputStream(HANDLE hOutput); - virtual ~wxPipeOutputStream(); + virtual ~wxPipeOutputStream() { Close(); } + bool Close(); protected: size_t OnSysWrite(const void *buffer, size_t len); @@ -444,11 +445,12 @@ wxPipeOutputStream::wxPipeOutputStream(HANDLE hOutput) } } -wxPipeOutputStream::~wxPipeOutputStream() +bool wxPipeOutputStream::Close() { - ::CloseHandle(m_hOutput); + return ::CloseHandle(m_hOutput) != 0; } + size_t wxPipeOutputStream::OnSysWrite(const void *buffer, size_t len) { m_lasterror = wxSTREAM_NO_ERROR; @@ -529,7 +531,7 @@ static bool wxExecuteDDE(const wxString& ddeServer, long wxExecute(const wxString& cmd, int flags, wxProcess *handler) { - wxCHECK_MSG( !cmd.IsEmpty(), 0, wxT("empty command in wxExecute") ); + wxCHECK_MSG( !cmd.empty(), 0, wxT("empty command in wxExecute") ); #if wxUSE_THREADS // for many reasons, the code below breaks down if it's called from another @@ -886,11 +888,17 @@ long wxExecute(const wxString& cmd, int flags, wxProcess *handler) return pi.dwProcessId; } - wxAppTraits *traits = wxTheApp ? wxTheApp->GetTraits() : NULL; - wxCHECK_MSG( traits, -1, _T("no wxAppTraits in wxExecute()?") ); + wxAppTraits *traits = NULL; + void *cookie = NULL; + if ( !(flags & wxEXEC_NODISABLE) ) + { + if ( wxTheApp ) + traits = wxTheApp->GetTraits(); + wxCHECK_MSG( traits, -1, _T("no wxAppTraits in wxExecute()?") ); - // disable all app windows while waiting for the child process to finish - void *cookie = traits->BeforeChildWaitLoop(); + // disable all app windows while waiting for the child process to finish + cookie = traits->BeforeChildWaitLoop(); + } // wait until the child process terminates while ( data->state ) @@ -908,7 +916,8 @@ long wxExecute(const wxString& cmd, int flags, wxProcess *handler) traits->AlwaysYield(); } - traits->AfterChildWaitLoop(cookie); + if ( traits ) + traits->AfterChildWaitLoop(cookie); DWORD dwExitCode = data->dwExitCode; delete data;