SublimeText / LaTeXTools

LaTeX plugin for Sublime Text
https://latextools.readthedocs.io/
2k stars 364 forks source link

Math preview should timeout #1465

Open PhelypeOleinik opened 4 years ago

PhelypeOleinik commented 4 years ago

Sometimes an equation can be mistyped (users do all sorts of weird LaTeX gymnastics:

\begin{array}{c}
  a\\\noalign{\vspace{\baselineskip pt}}
\end{array}

from here: https://tex.stackexchange.com/a/530261/134574) which can lead TeX into an infinite loop. I tried the code above once, and then forgot about it. A couple hours later I noticed that the CPU was busy and went to find a pdfTeX process running forever.

I think it would be nice to have a (configurable) timeout for math preview, after which the LaTeX run is killed, to avoid this type of thing. I'd say 10 seconds is probably enough for normal equations, but suppose someone has loaded a huge bundle of packages, more than 60 seconds for one equation most likely means it's stuck, and it would be a good limit to stop a potentially infinite process.

This is sort of similar to #1349, but the problem there is a compilation error (after which TeX prompts for interaction) but when TeX is stuck in an infinite loop, -interaction=nonstopmode will do nothing useful.