]> git.lyx.org Git - lyx.git/blobdiff - src/support/Systemcall.cpp
cleanup error messages
[lyx.git] / src / support / Systemcall.cpp
index d4a3b514fbe84de697e4a213970e97384ed79a6a..3cb420bb518ebd1ccd106206e81c2dae48ed815e 100644 (file)
@@ -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 = 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;
        }
@@ -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) {