bool progress_panel = false;
char buf[256];
wxString cmdstr(cmdline, WX_DEFAULT_CONV);
- wxLongLong startTime;
+ wxLongLong startTime, lastTime, presentTime;
if (m_process != NULL)
return -1; // Another process is already running (CallSubProcess() allows only one subprocess)
ShowProgressPanel(buf);
progress_panel = true;
}
- startTime = wxGetUTCTimeMillis();
+ startTime = lastTime = wxGetUTCTimeMillis();
// Create log file in the document home directory
#if LOG_SUBPROCESS
wxString bufstr;
wxString buferrstr;
while (1) {
- int len1 = m_process->GetLine(bufstr);
- if (len1 > 0) {
+ int len1, len2;
+ lastTime = wxGetUTCTimeMillis();
+ while ((len1 = m_process->GetLine(bufstr)) > 0) {
#if LOG_SUBPROCESS
dateTime.SetToCurrent();
fprintf(fplog, "%s[STDOUT]%s", (const char *)(dateTime.FormatISOCombined(' ')), (const char *)bufstr);
MyAppCallback_setConsoleColor(0);
MyAppCallback_showScriptMessage("%s", (const char *)bufstr);
}
+ presentTime = wxGetUTCTimeMillis();
+ if (presentTime > lastTime + 25) {
+ presentTime = lastTime;
+ break;
+ }
}
- int len2 = m_process->GetErrorLine(buferrstr);
- if (len2 > 0) {
+ while ((len2 = m_process->GetErrorLine(buferrstr)) > 0) {
#if LOG_SUBPROCESS
dateTime.SetToCurrent();
fprintf(fplog, "%s[STDERR]%s", (const char *)(dateTime.FormatISOCombined(' ')), buf);
MyAppCallback_showScriptMessage("\n%s", (const char *)buferrstr);
MyAppCallback_setConsoleColor(0);
}
+ presentTime = wxGetUTCTimeMillis();
+ if (presentTime > lastTime + 25) {
+ presentTime = lastTime;
+ break;
+ }
}
-
if (len1 < 0 && len2 < 0) {
// The standard/error outputs are exhausted; the process should have terminated
// (Normally, this should be detected by wxBetterProcess::OnTerminate())
if (callback_result != 0)
interrupted = true;
}
+ ::wxSafeYield(); // This allows updating console and wxProcess status
if (progress_panel) {
SetProgressValue(-1);
if (IsInterrupted())
interrupted = true;
- } else {
- ::wxSafeYield(); // This allows updating console and wxProcess status
}
#if LOG_SUBPROCESS