[Tex/LaTex] Why does lualatex return with exit code 1 even though a PDF was built

errorsluatex

Using TeXLive 2011, I invoke lualatex on a TeX file from the command line. The PDF builds (mostly correctly, although the source TeX file has many many errors and warnings, none fatal). However, the exit code (%ERRORLEVEL%) is set to 1, which is normally used to indicate an error. Why does this happen?

Best Answer

A standard behavior for programs is to exit with a non zero exit status when some error has been encountered during the execution.

The fact that the errors are not fatal and that some output is produced doesn't change this behavior that can be used in scripts or other programming environments.

Only warnings, such as "Overfull \hbox" or similar ones, make the exit status to be 0.