wxString bufstr;
wxString buferrstr;
while (1) {
- m_process->GetLine(bufstr);
- if (bufstr.Length() > 0) {
+ int len1 = m_process->GetLine(bufstr);
+ if (len1 > 0) {
#if LOG_SUBPROCESS
dateTime.SetToCurrent();
fprintf(fplog, "%s[STDOUT]%s", (const char *)(dateTime.FormatISOCombined(' ')), (const char *)bufstr);
MyAppCallback_showScriptMessage("%s", (const char *)bufstr);
}
}
- m_process->GetErrorLine(buferrstr);
- if (buferrstr.Length() > 0) {
+ int len2 = m_process->GetErrorLine(buferrstr);
+ if (len2 > 0) {
#if LOG_SUBPROCESS
dateTime.SetToCurrent();
fprintf(fplog, "%s[STDERR]%s", (const char *)(dateTime.FormatISOCombined(' ')), buf);
}
}
+ if (len1 < 0 && len2 < 0) {
+ // The standard/error outputs are exhausted; the process should have terminated
+ // (Normally, this should be detected by wxBetterProcess::OnTerminate())
+ interrupted = true;
+ }
::wxMilliSleep(25);
if (callback != NULL && callback != DUMMY_CALLBACK) {
callback_result = (*callback)(callback_data);
SetProgressValue(-1);
if (IsInterrupted())
interrupted = true;
+ } else {
+ ::wxSafeYield(); // This allows updating console and wxProcess status
}
#if LOG_SUBPROCESS