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(