X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/9978ac8e4f52e47a07c146cfa17ba69bf2cc0338..9967de02678d23a149183bc5908c7fadcd4f76eb:/src/msw/utilsexc.cpp diff --git a/src/msw/utilsexc.cpp b/src/msw/utilsexc.cpp index a675969f7e..515d506d63 100644 --- a/src/msw/utilsexc.cpp +++ b/src/msw/utilsexc.cpp @@ -987,13 +987,13 @@ long wxExecute(const wxString& cmd, int flags, wxProcess *handler) while ( data->state ) { #if wxUSE_STREAMS && !defined(__WXWINCE__) - bufOut.Update(); - bufErr.Update(); + if ( !bufOut.Update() && !bufErr.Update() ) #endif // wxUSE_STREAMS - - // don't eat 100% of the CPU -- ugly but anything else requires - // real async IO which we don't have for the moment - ::Sleep(50); + { + // don't eat 100% of the CPU -- ugly but anything else requires + // real async IO which we don't have for the moment + ::Sleep(50); + } // we must process messages or we'd never get wxWM_PROC_TERMINATED traits->AlwaysYield(); @@ -1012,9 +1012,11 @@ long wxExecute(const wxString& cmd, int flags, wxProcess *handler) return dwExitCode; } -long wxExecute(wxChar **argv, int flags, wxProcess *handler) +template +long wxExecuteImpl(CharType **argv, int flags, wxProcess *handler) { wxString command; + command.reserve(1024); for ( ;; ) { @@ -1022,8 +1024,22 @@ long wxExecute(wxChar **argv, int flags, wxProcess *handler) if ( !*argv ) break; - command += _T(' '); + command += ' '; } return wxExecute(command, flags, handler); } + +long wxExecute(char **argv, int flags, wxProcess *handler) +{ + return wxExecuteImpl(argv, flags, handler); +} + +#if wxUSE_UNICODE + +long wxExecute(wchar_t **argv, int flags, wxProcess *handler) +{ + return wxExecuteImpl(argv, flags, handler); +} + +#endif // wxUSE_UNICODE