]> git.lyx.org Git - lyx.git/commit
Check exit code of LaTeX process in LaTeX::run
authorScott Kostyshak <skostysh@lyx.org>
Fri, 20 Mar 2015 04:40:01 +0000 (00:40 -0400)
committerScott Kostyshak <skostysh@lyx.org>
Fri, 20 Mar 2015 06:19:44 +0000 (02:19 -0400)
commit1dbf0e5aab732bdba4eed1af2866c357bc30a526
tree1ad071b9deca582b31a4f0d0f6705e773690701d
parentf74b2b79c7925454ba01b42bbd30c64f0ab30d31
Check exit code of LaTeX process in LaTeX::run

Systemcall::startscript returns the exit code of the LaTeX command
that is run, but the return value was not being checked by
LaTeX::run.  Instead, we relied on parsing log files. However, this
parsing is not perfect.

The return value is now checked and if the exit code of the command
is non-zero, an enum value is added to the return and the user is
notified of the error.

At a higher level, if the LaTeX command returns a non-zero exit code,
in the GUI a message such as
"Error while exporting format: PDF (LuaTeX)" will be given instead of
"Successful preview of format: PDF (LuaTeX)".

When run on the commandline, lyx -e lualatex example.lyx
will give "Error: LaTeX failed" and a non-zero exit code
where before it gave a zero exit code.

A real example of the bug this commit fixes is LyX's (as of this commit)
ACM-sigplan.lyx template.
Before this commit:
  $ lyx -e pdf2 ACM-sigplan.lyx
  [...snip...]
  support/Systemcall.cpp (288): Systemcall: 'pdflatex  "ACM-sigplan.tex"'
  finished with exit code 1
  $ echo $?
  0
Starting with this commit:
  $ mylyx master -e pdf2 ACM-sigplan.lyx
  support/Systemcall.cpp (288): Systemcall: 'pdflatex  "ACM-sigplan.tex"'
  finished with exit code 1
  Error: LaTeX failed
  ----------------------------------------
  LaTeX did not run successfully. The command that was run exited with
  error.
  $ echo $?
  1
RELEASE-NOTES
src/Converter.cpp
src/LaTeX.cpp
src/LaTeX.h