From b5d4eb8402bc605fb8d52701abd576343dfd3bd4 Mon Sep 17 00:00:00 2001 From: Adam Chidlow Date: Thu, 12 Sep 2024 14:56:25 +0800 Subject: [PATCH] ensure exit code is set correctly when there are logged errors (not marking as a fix since it's an unreleased regression & problem with an unreleased feature) --- src/puya/main.py | 2 ++ src/puyapy/compile.py | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/puya/main.py b/src/puya/main.py index b7dcba0faf..82ec762bbc 100644 --- a/src/puya/main.py +++ b/src/puya/main.py @@ -45,3 +45,5 @@ def main(*, options_json: str, awst_json: str, source_annotations_json: str | No case other: logger.error(f"unexpected compilation target type: {type(other).__name__}") awst_to_teal(log_ctx, options, compilation_set, sources_by_path, awst) + # note: needs to be outside the with block + log_ctx.exit_if_errors() diff --git a/src/puyapy/compile.py b/src/puyapy/compile.py index 0ea11bbf3d..925b436f83 100644 --- a/src/puyapy/compile.py +++ b/src/puyapy/compile.py @@ -79,7 +79,8 @@ def compile_to_teal(puyapy_options: PuyaPyOptions) -> None: log_ctx.exit_if_errors() if puyapy_options.output_client: write_arc32_clients(compilation_set, teal) - log_ctx.exit_if_errors() + # needs to be outside the with block + log_ctx.exit_if_errors() def write_arc32_clients(