• R/O
  • HTTP
  • SSH
  • HTTPS

Molby: コミット

Molecular Modeling Software


コミットメタ情報

リビジョンf6d97e8d931665836a88cbc1c0af4e1f0498bfe9 (tree)
日時2022-01-29 00:14:00
作者Toshi Nagata <alchemist.2005@nift...>
コミッターToshi Nagata

ログメッセージ

Calling subprocess was (still) having problems. Hopefully fixed.

変更サマリ

差分

--- a/wxSources/MyApp.cpp
+++ b/wxSources/MyApp.cpp
@@ -1484,8 +1484,8 @@ MyApp::CallSubProcess(const char *cmdline, const char *procname, int (*callback)
14841484 wxString bufstr;
14851485 wxString buferrstr;
14861486 while (1) {
1487- m_process->GetLine(bufstr);
1488- if (bufstr.Length() > 0) {
1487+ int len1 = m_process->GetLine(bufstr);
1488+ if (len1 > 0) {
14891489 #if LOG_SUBPROCESS
14901490 dateTime.SetToCurrent();
14911491 fprintf(fplog, "%s[STDOUT]%s", (const char *)(dateTime.FormatISOCombined(' ')), (const char *)bufstr);
@@ -1501,8 +1501,8 @@ MyApp::CallSubProcess(const char *cmdline, const char *procname, int (*callback)
15011501 MyAppCallback_showScriptMessage("%s", (const char *)bufstr);
15021502 }
15031503 }
1504- m_process->GetErrorLine(buferrstr);
1505- if (buferrstr.Length() > 0) {
1504+ int len2 = m_process->GetErrorLine(buferrstr);
1505+ if (len2 > 0) {
15061506 #if LOG_SUBPROCESS
15071507 dateTime.SetToCurrent();
15081508 fprintf(fplog, "%s[STDERR]%s", (const char *)(dateTime.FormatISOCombined(' ')), buf);
@@ -1517,6 +1517,11 @@ MyApp::CallSubProcess(const char *cmdline, const char *procname, int (*callback)
15171517 }
15181518 }
15191519
1520+ if (len1 < 0 && len2 < 0) {
1521+ // The standard/error outputs are exhausted; the process should have terminated
1522+ // (Normally, this should be detected by wxBetterProcess::OnTerminate())
1523+ interrupted = true;
1524+ }
15201525 ::wxMilliSleep(25);
15211526 if (callback != NULL && callback != DUMMY_CALLBACK) {
15221527 callback_result = (*callback)(callback_data);
@@ -1527,6 +1532,8 @@ MyApp::CallSubProcess(const char *cmdline, const char *procname, int (*callback)
15271532 SetProgressValue(-1);
15281533 if (IsInterrupted())
15291534 interrupted = true;
1535+ } else {
1536+ ::wxSafeYield(); // This allows updating console and wxProcess status
15301537 }
15311538
15321539 #if LOG_SUBPROCESS
旧リポジトリブラウザで表示