Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log pdflatex output on error #667

Merged
merged 4 commits into from
Apr 5, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 16 additions & 18 deletions keiko/keiko/keiko.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,24 +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 range(2):
praseodym marked this conversation as resolved.
Show resolved Hide resolved
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(output.stdout.decode("utf-8"))
logger.error(output.stderr.decode("utf-8"))
praseodym marked this conversation as resolved.
Show resolved Hide resolved
raise Exception("Error in pdflatex run %d", i)
else:
logger.debug(output.stdout.decode("utf-8"))
logger.debug(output.stderr.decode("utf-8"))
praseodym marked this conversation as resolved.
Show resolved Hide resolved

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