# Why does lualatex return with exit code 1 even though a PDF was built?

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?

-
Welcome to TeX.sx! Please add a minimal working example (MWE) that illustrates your problem. –  Werner Nov 9 '11 at 16:55
This is perfectly normal, when errors are encountered during compilation. –  egreg Nov 9 '11 at 16:56
The output is started before all processing is complete. It is a common data processing pattern, and the presence of an output file does not imply success. –  Andrey Vihrov Nov 9 '11 at 17:21

## 1 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.

-