I'm using latexmk for compilation of my document and want to limit time for every compile cycle. In order to do it I use timeout util in following way:

latexmk -f -pdf -bibtex \
  -pdflatex="timeout 5s xelatex -interaction=nonstopmode -synctex=-1 %O %S" \

When a compile cycle takes more than 5s then TERM signal is being sent and the cycle is being killed. But the return code is 31744 as reported by latexmk:

Collected error summary (may duplicate other messages):
  pdflatex: Command for 'pdflatex' gave return code 31744

timeout util says that it should be 124: If the command times out ... then exit with status 124

I took a look at latexmk source and the exit code it's talking about is captured from the provided command run (in my case it's timeout 5s xelatex...)

I had an idea that it's because pdflatex catches SIGTERM and tried using SIGKILL in timeout command timeout --signal=SIGKILL 5s... but there were exit code 35072.

So, my question is what are these strange exit codes? Where do they come from and what do they mean? I took a look at pdftex and xetex sources but found no mentions of them. Can I be sure that 31744 exit code means SIGTERM and nothing else?

A short note about the software I'm using:

  • latexmk 4.39
  • XeTeX, Version 3.1415926-2.5-0.9999.3 (TeX Live 2013/Debian)
  • timeout from GNU coreutils 8.23

Thank you for any help.

  • 2
    Just FYI, 31744 is 124 shifted by 1 byte (8 bit) to the left.
    – Juri Robl
    Commented Jan 26, 2015 at 15:30

1 Answer 1


The codes reported by latexmk are those reported by Perl's system function. As stated in the documentation of this function, http://perldoc.perl.org/functions/system.html, these codes are the exit code of the executed program shifted left by 8 bits. (There is some extra information in the low order bits.) Therefore, to get the actual exit code of the executed program, just divide the exit code reported by latexmk by 256.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .