s_Kernel_CallSubProcess(int argc, VALUE *argv, VALUE self)
{
VALUE cmd, procname, cproc, stdout_val, stderr_val;
+ VALUE save_interruptFlag;
int n, exitstatus, pid;
char *sout, *serr;
FILE *fpout, *fperr;
rb_raise(rb_eMolbyError, "Cannot open file for standard output (%s)", serr);
}
}
-
+
+ save_interruptFlag = s_SetInterruptFlag(self, Qnil);
n = MyAppCallback_callSubProcess(StringValuePtr(cmd), StringValuePtr(procname), (cproc == Qnil ? NULL : s_Kernel_CallSubProcess_Callback), (cproc == Qnil ? NULL : (void *)cproc), fpout, fperr, &exitstatus, &pid);
-
+ s_SetInterruptFlag(self, save_interruptFlag);
+
if (fpout != NULL && fpout != (FILE *)1)
fclose(fpout);
if (fperr != NULL && fperr != (FILE *)1)
{
wxString string((mes ? mes : ""), WX_DEFAULT_CONV);
if (m_progressDialog == NULL) {
- m_progressDialog = new wxProgressDialog(wxT("Progress"), mes);
+ m_progressDialog = new wxProgressDialog(wxT("Progress"), mes, 100, NULL, wxPD_APP_MODAL | wxPD_CAN_ABORT);
}
/*
#if __WXMAC__
MyApp::HideProgressPanel()
{
if (m_progressDialog != NULL) {
+ m_progressDialog->Hide();
m_progressDialog->Destroy();
m_progressDialog = NULL;
}
nn = 0;
}
#endif
- if (m_process->IsTerminated()) {
+ if (m_process->IsTerminated() || !wxProcess::Exists(pid)) {
/* The subprocess has terminated */
status = m_process->GetStatus();
break;
status = -2; /* User interrupt */
}
m_process->Detach();
+ m_process = NULL;
break;
}
}
}
if (m_process != NULL) {
- delete m_process;
+ m_process->Detach();
m_process = NULL;
}
}
if (trial > 0) {
// stream->Read() is called only once
+ outStr = _T("");
if (err == wxSTREAM_EOF)
return -1; // EOF and no data left
return 0; // Not EOF, but no data is available at present