[tex-k] return values of (pdf)(la)tex

Karl Berry karl at freefriends.org
Tue Apr 16 23:00:08 CEST 2024


    is there any clear listing under which circumstances (pdf)(la|e)tex
    returns which return code?

Not so far as I know. The basic answer for tex.web is that the exit
status is 1 if |history| has been set to |error_message_issued| or
|fatal_error_stop|, per tex.ch:

  @d do_final_end==begin
     update_terminal;
     ready_already:=0;
     if (history <> spotless) and (history <> warning_issued) then
         uexit(1)
     else
         uexit(0);
     end

grep -r uexit web2c/ shows that it is called in numerous places in the
support code, e.g., lib/texmfmp.c, ptexdir/kanji.c,
xetexdir/XeTeX_ext.c, luatexdir/*/*, etc.

I see exactly one place where uexit is called with a value other than
0 or 1, in xetexdir/XeTeX_ext.c:
        default:
            /* this can't happen */
            fprintf(stderr, "! Internal error---file input mode=%d.\n", f->encodingMode);
            uexit(3);

I am not certain that searching for uexit finds every single place that
an exit happens.

The TeX macro level can't directly affect the exit code. I mean, apart
from calling \errmessage, etc. Lua can exit.

Does that help? --best, karl.


More information about the tex-k mailing list.