// Reuse of instance
#ifndef USE_QPROCESS
-int Systemcall::startscript(Starttype how, string const & what)
+int Systemcall::startscript(Starttype how, string const & what,
+ bool /*process_events*/)
{
string command = what;
-int Systemcall::startscript(Starttype how, string const & what)
+int Systemcall::startscript(Starttype how, string const & what, bool process_events)
{
string outfile;
QString cmd = toqstr(parsecmd(what, outfile));
SystemcallPrivate d(outfile);
- bool process_events = true;
d.startProcess(cmd);
- if (!d.waitWhile(SystemcallPrivate::Starting, process_events, 3000)) {
- LYXERR0("QProcess " << cmd << " did not start!");
+ if (!d.waitWhile(SystemcallPrivate::Starting, process_events, -1)) {
+ LYXERR0("Systemcall: '" << cmd << " did not start!");
LYXERR0("error " << d.errorMessage());
return 10;
}
}
if (!d.waitWhile(SystemcallPrivate::Running, process_events, 180000)) {
- LYXERR0("QProcess " << cmd << " did not finished!");
+ LYXERR0("Systemcall: '" << cmd << "' did not finished!");
LYXERR0("error " << d.errorMessage());
LYXERR0("status " << d.exitStatusMessage());
return 20;
int const exit_code = d.exitCode();
if (exit_code) {
- LYXERR0("QProcess " << cmd << " finished!");
- LYXERR0("error " << exit_code << ": " << d.errorMessage());
+ LYXERR0("Systemcall: '" << cmd << "' finished with exit code " << exit_code);
}
return exit_code;
SystemcallPrivate::SystemcallPrivate(const std::string& of) :
- proc_(new QProcess), outindex_(0), process_events(false),
- errindex_(0), outfile(of), showout_(false), showerr_(false)
+ proc_(new QProcess), outindex_(0), errindex_(0),
+ outfile(of), showout_(false), showerr_(false), process_events(false)
{
if (!outfile.empty()) {
// Check whether we have to simply throw away the output.
}
}
+
void SystemcallPrivate::processEvents()
{
if(process_events) {
}
}
+
void SystemcallPrivate::waitAndProcessEvents()
{
Sleep::millisec(100);
}
-
SystemcallPrivate::~SystemcallPrivate()
{
flush();
}
}
+
void SystemcallPrivate::stdOut()
{
if (proc_ && showout_) {
}
-void SystemcallPrivate::processFinished(int, QProcess::ExitStatus status)
+void SystemcallPrivate::processFinished(int, QProcess::ExitStatus)
{
state = Finished;
}
-void SystemcallPrivate::processError(QProcess::ProcessError err)
+void SystemcallPrivate::processError(QProcess::ProcessError)
{
state = Error;
}
return message;
}
+
int SystemcallPrivate::exitCode()
{
if (!proc_)
killProcess(proc_);
}
+
void SystemcallPrivate::killProcess(QProcess * p)
{
if (p) {