1
0

b/c...py: warn about exit code during only rendering

This commit is contained in:
Intel A80486DX2-66 2024-09-22 23:59:41 +03:00
parent e810309303
commit 16f5272df1
Signed by: 80486DX2-66
GPG Key ID: 83631EF27054609B

View File

@ -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: