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: