Skip to content

Commit

Permalink
Log pdflatex output on error (1.7) (#669)
Browse files Browse the repository at this point in the history
  • Loading branch information
praseodym authored Apr 5, 2023
1 parent 6a72205 commit 3eac7c7
Showing 1 changed file with 16 additions and 23 deletions.
39 changes: 16 additions & 23 deletions keiko/keiko/keiko.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,29 +121,22 @@ def generate_report(
tex_output_file_name,
]
env = {**os.environ, "TEXMFVAR": tmp_dirname}
output = subprocess.run(cmd, cwd=tmp_dirname, env=env, capture_output=True, check=False)
logger.info(
"pdflatex run. [report_id=%s] [template=%s] [command=%s]",
report_id,
template_name,
" ".join(cmd),
)
logger.debug(output.stdout.decode("utf-8"))
logger.debug(output.stderr.decode("utf-8"))
if output.returncode:
raise Exception("Error running pdflatex")

output = subprocess.run(cmd, cwd=tmp_dirname, env=env, capture_output=True, check=False)
logger.info(
"pdflatex run. [report_id=%s] [template=%s] [command=%s]",
report_id,
template_name,
" ".join(cmd),
)
logger.debug(output.stdout.decode("utf-8"))
logger.debug(output.stderr.decode("utf-8"))
if output.returncode:
raise Exception("Error running pdflatex")
for i in (1, 2):
output = subprocess.run(cmd, cwd=tmp_dirname, env=env, capture_output=True, check=False)
logger.info(
"pdflatex [run=%d] [report_id=%s] [template=%s] [command=%s]",
i,
report_id,
template_name,
" ".join(cmd),
)
if output.returncode:
logger.error("stdout: %s", output.stdout.decode("utf-8"))
logger.error("stderr: %s", output.stderr.decode("utf-8"))
raise Exception("Error in pdflatex run %d", i)
else:
logger.debug(output.stdout.decode("utf-8"))
logger.debug(output.stderr.decode("utf-8"))

# copy result back to output folder
Path(settings.reports_folder).mkdir(parents=True, exist_ok=True)
Expand Down

0 comments on commit 3eac7c7

Please sign in to comment.