From 5027ee1d8a912c17066264fa6c0621c76b0a376f Mon Sep 17 00:00:00 2001 From: "David A. Hannasch" Date: Tue, 13 Aug 2019 15:03:21 -0600 Subject: [PATCH 1/3] Captures LaTeX build errors; right now, this just prints them. --- latex/build.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/latex/build.py b/latex/build.py index 9fad818..f1f8db0 100644 --- a/latex/build.py +++ b/latex/build.py @@ -103,13 +103,15 @@ def build_pdf(self, source, texinputs=[]): newenv['TEXINPUTS'] = os.pathsep.join(texinputs) + os.pathsep try: - subprocess.check_call(args, - cwd=tmpdir, - env=newenv, - stdin=open(os.devnull, 'r'), - stdout=open(os.devnull, 'w'), - stderr=open(os.devnull, 'w'), ) + subprocess.run(args, + cwd=tmpdir, + check=True, + env=newenv, + capture_output=True, + ) except CalledProcessError as e: + assert not e.stdout + print(e.stderr) raise_from(LatexBuildError(base_fn + '.log'), e) return I(open(output_fn, 'rb').read(), encoding=None) From 5c300fe90cdcc0d5eb87e3f0798defd5271fc39b Mon Sep 17 00:00:00 2001 From: "David A. Hannasch" Date: Tue, 13 Aug 2019 15:45:59 -0600 Subject: [PATCH 2/3] sometimes have stdout --- latex/build.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/latex/build.py b/latex/build.py index f1f8db0..5206d32 100644 --- a/latex/build.py +++ b/latex/build.py @@ -110,7 +110,7 @@ def build_pdf(self, source, texinputs=[]): capture_output=True, ) except CalledProcessError as e: - assert not e.stdout + print(e.stdout) print(e.stderr) raise_from(LatexBuildError(base_fn + '.log'), e) From 4dd216c5f7b0ab0e585c8e8cfb38ee6e9008aed6 Mon Sep 17 00:00:00 2001 From: "David A. Hannasch" Date: Tue, 13 Aug 2019 15:47:29 -0600 Subject: [PATCH 3/3] Use forward slashes in file paths on Windows. --- latex/build.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/latex/build.py b/latex/build.py index 5206d32..733d3a3 100644 --- a/latex/build.py +++ b/latex/build.py @@ -89,7 +89,7 @@ def build_pdf(self, source, texinputs=[]): args = [self.latexmk, '-pdf', '-pdflatex={}'.format(' '.join(latex_cmd)), - tmp.name, ] + tmp.name.replace('\\', '/'), ] elif self.variant == 'xelatex': args = [self.latexmk, '-xelatex',