]> git.lyx.org Git - features.git/commitdiff
Detect when an external command crashes
authorScott Kostyshak <skostysh@lyx.org>
Sat, 4 Apr 2015 17:39:42 +0000 (13:39 -0400)
committerScott Kostyshak <skostysh@lyx.org>
Sat, 4 Apr 2015 17:45:19 +0000 (13:45 -0400)
This fixes a situation where LyX did not detect that something went
wrong (that an external comman crashed) and reported that export was
successful. To reproduce, use the following version of LuaTeX (the
bug in LuaTeX causing the crash has since been fixed):
LuaTeX, Version beta-0.79.1 (TeX Live 2014) (rev 4971)
Then open FeynmanDiagrams.lyx and export with PDF (LuaTeX).

In the documentation [1] for QProcess::exitCode() it states:
"This value is not valid unless exitStatus() returns NormalExit."

For more information, see:
https://www.mail-archive.com/lyx-devel@lists.lyx.org/msg185317.html

[1] http://doc.qt.io/qt-5/qprocess.html#exitCode

src/support/Systemcall.cpp

index 9327613dfdedda784546aaf2f0fb99651f77fdd9..2f277f6b9ec060cdfc665b525a47ad1ab55301ca 100644 (file)
@@ -610,6 +610,10 @@ int SystemcallPrivate::exitCode()
        if (!process_)
                return -1;
 
+       // From Qt's documentation, in regards to QProcess::exitCode(),
+       // "This value is not valid unless exitStatus() returns NormalExit"
+       if (process_->exitStatus() != QProcess::NormalExit)
+               return -1;
        return process_->exitCode();
 }