-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
Bug
macdoc pdf compile-check and macdoc pdf consolidate hang indefinitely when the input .tex file contains many errors.
Root Cause
TexCompileChecker invokes pdflatex -interaction=nonstopmode. On files with 100+ errors:
- pdflatex hits the hardcoded 100-error limit and emits
(That makes 100 errors; please try again.)→Fatal error occurred, no output PDF file produced! - However, in
nonstopmode, certain error types (group mismatch, missing}) cause pdflatex to not terminate cleanly — it hangs at 0% CPU waiting for something. - macdoc's process is waiting for pdflatex's stdout/stderr to close → deadlock.
Observed Behavior
pdflatex -interaction=nonstopmodehangs (CPU 0%, indefinitely)pdflatex -interaction=batchmodecompletes (exits with error code 1, produces log)pdflatex -interaction=scrollmodealso completes
Reproduction
# 741-page Wooldridge textbook, AI-transcribed with ~300+ LaTeX errors
macdoc pdf init --pdf wooldridge.pdf --output wooldridge-latex
macdoc pdf segment --project wooldridge-latex
macdoc pdf render --project wooldridge-latex
macdoc pdf blocks --project wooldridge-latex
macdoc pdf transcribe-pages --project wooldridge-latex --backend codex
macdoc pdf chapters --project wooldridge-latex
macdoc pdf assemble --project wooldridge-latex --skip-compile
# These hang:
macdoc pdf compile-check --project wooldridge-latex # hangs
macdoc pdf consolidate --project wooldridge-latex --agent claude # hangs at compile stepSuggested Fix
- Use
batchmodeinstead ofnonstopmodeinTexCompileChecker— batchmode always terminates - Add a timeout (e.g., 120s) to the pdflatex subprocess — kill it if it doesn't exit
- Pipe stdin from
/dev/nullto prevent pdflatex from waiting for user input on certain errors
All three would independently fix the deadlock. Combining (1) + (2) would be most robust.
Environment
- macdoc v0.4.0
- pdfTeX 3.141592653-2.6-1.40.27 (TeX Live 2025)
- macOS 15.3 (Darwin 25.3.0)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels