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
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 )
traits->AlwaysYield();
}
- traits->AfterChildWaitLoop(cookie);
+ if ( traits )
+ traits->AfterChildWaitLoop(cookie);
DWORD dwExitCode = data->dwExitCode;
delete data;