X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fsupport%2FSystemcall.cpp;h=3cb420bb518ebd1ccd106206e81c2dae48ed815e;hb=68957712dd4228a76b14611108fb61d926071e1f;hp=83373d012d5cc37ed0c330ab65623881285714f5;hpb=74e77476b5c6f39c0f98c5b64822710ac97911d7;p=lyx.git diff --git a/src/support/Systemcall.cpp b/src/support/Systemcall.cpp index 83373d012d..3cb420bb51 100644 --- a/src/support/Systemcall.cpp +++ b/src/support/Systemcall.cpp @@ -52,7 +52,8 @@ namespace support { // 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; @@ -99,17 +100,16 @@ string const parsecmd(string const & cmd, string & outfile) -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 = false; 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; } @@ -121,7 +121,7 @@ int Systemcall::startscript(Starttype how, string const & what) } 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; @@ -129,8 +129,7 @@ int Systemcall::startscript(Starttype how, string const & what) 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; @@ -138,8 +137,8 @@ int Systemcall::startscript(Starttype how, string const & what) 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. @@ -167,6 +166,7 @@ void SystemcallPrivate::startProcess(const QString& cmd) } } + void SystemcallPrivate::processEvents() { if(process_events) { @@ -175,6 +175,7 @@ void SystemcallPrivate::processEvents() } } + void SystemcallPrivate::waitAndProcessEvents() { Sleep::millisec(100); @@ -217,7 +218,6 @@ bool SystemcallPrivate::waitWhile(State waitwhile, bool proc_events, int timeout } - SystemcallPrivate::~SystemcallPrivate() { flush(); @@ -254,6 +254,7 @@ void SystemcallPrivate::flush() } } + void SystemcallPrivate::stdOut() { if (proc_ && showout_) { @@ -298,13 +299,13 @@ void SystemcallPrivate::processStarted() } -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; } @@ -364,6 +365,7 @@ QString SystemcallPrivate::exitStatusMessage() const return message; } + int SystemcallPrivate::exitCode() { if (!proc_) @@ -386,6 +388,7 @@ void SystemcallPrivate::killProcess() killProcess(proc_); } + void SystemcallPrivate::killProcess(QProcess * p) { if (p) {