saadq / node-latex

🧾 A utility for running LaTeX subprocesses in Node.
MIT License
58 stars 22 forks source link

EPIPE when source begins with comment line #2

Closed rwestlund closed 7 years ago

rwestlund commented 7 years ago

I ran into a weird issue. When the first non-blank line in my LaTeX file is a % comment, it causes node to crash with EPIPE and texput.log complains about an invalid character. If I swap my comment line and \documentclass declaration so that \documentclass comes first, it works just fine.

I can't reproduce this from the command line: pdflatex -halt-on-error < source.tex works just fine. I'd be curious to know whether anyone else sees this behavior.

rwestlund commented 7 years ago

I can reproduce this now; I neglected to include -output-directory in my previous testing. That argument is the culprit here. When run on a document that begins with a comment, the following error is produced:

randy@alderaan /tmp> pdflatex -halt-on-error -output-directory /tmp < latex.tex
This is pdfTeX, Version 3.14159265-2.6-1.40.16 (Web2C 2015) (preloaded format=pdflatex)
 restricted \write18 enabled.
**entering extended mode

*(/tmp/
LaTeX2e <2015/01/01> patch level 2
Babel <3.9l> and hyphenation patterns for 79 languages loaded.
! Text line contains an invalid character.
l.1 ^^@
       ^^@^^L^^@^^D^^A.^^@^^@^^@^^B^^@^^@^^@^^L^^@^^D^^B..^^@^^@^^D4^^Q^^@...
!  ==> Fatal error occurred, no output PDF file produced!
Transcript written on /tmp/texput.log.