From 16f5272df1ddfdb21177d57a8f5c5d070dc0fd3a Mon Sep 17 00:00:00 2001 From: Intel A80486DX2-66 Date: Sun, 22 Sep 2024 23:59:41 +0300 Subject: [PATCH] b/c...py: warn about exit code during only rendering --- bytebeat_compiler.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/bytebeat_compiler.py b/bytebeat_compiler.py index ebd57f4..baafcf1 100644 --- a/bytebeat_compiler.py +++ b/bytebeat_compiler.py @@ -87,10 +87,12 @@ def substitute_vars(replacements: Dict[str, Union[bool, str]], text: str, print() return text -def run_command(*command: list[str]) -> None: +def run_command(*command: list[str], stage: str) -> None: print("[>]", command_line_join(command), flush=True) if subprocess.run(command).returncode != EXIT_SUCCESS: - print("An error occured during rendering!") + if stage == "rendering": + print("An error occured during rendering!") + raise SystemExit(EXIT_FAILURE) def compile_substituted_file(input_file: str, executable_file: str) -> None: @@ -102,9 +104,10 @@ def compile_substituted_file(input_file: str, executable_file: str) -> None: input_file, PATHS["fwrite_le"], "-o", executable_file, - "-I" + PATHS["include_directory"] + "-I" + PATHS["include_directory"], + stage="compilation" ) - run_command(executable_file) + run_command(executable_file, stage="rendering") def main_workflow(input_file: str, executable_file: str, \ substitute_contents: Dict[str, str]) -> None: