From 1919582a7194f02e4766877ca061cf2ee0199833 Mon Sep 17 00:00:00 2001 From: felix Date: Sun, 9 Jul 2017 14:31:54 +0200 Subject: [PATCH] Disable line wrapping with the max_print_line environment variable Set max_print_line environment variable to 2^31-1 in order to effectively disable line wrapping instead of unwrapping it on our own, which is highly fragile. TeX should never output 2 GiB of logs. We hope. --- latexrun | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/latexrun b/latexrun index b669d9f..ab8e95a 100755 --- a/latexrun +++ b/latexrun @@ -763,7 +763,8 @@ class LaTeX(Task): p = subprocess.Popen(args, stdin=subprocess.DEVNULL, stdout=subprocess.PIPE, - stderr=subprocess.STDOUT) + stderr=subprocess.STDOUT, + env={**os.environ, 'max_print_line': '2147483647'}) stdout, has_errors, missing_includes = self.__feed_terminal(p.stdout) status = p.wait() except OSError as e: @@ -1171,19 +1172,6 @@ class LaTeXFilter: self.__ensure_line() data = self.__data[self.__pos:self.__lend] self.__pos = self.__lend - if unwrap: - # TeX helpfully wraps all terminal output at 79 columns - # (max_print_line). If requested, unwrap it. There's - # simply no way to do this perfectly, since there could be - # a line that happens to be 79 columns. - # - # We check for >=80 because a bug in LuaTeX causes it to - # wrap at 80 columns instead of 79 (LuaTeX #900). - while self.__lend - self.__lstart >= 80: - if self.TRACE: print('<{}> wrapping'.format(self.__pos)) - self.__ensure_line() - data = data[:-1] + self.__data[self.__pos:self.__lend] - self.__pos = self.__lend return data # Parser productions