1
0

bytebeat_compiler.py: make use of shlex.join

When printing a command that is going to be ran, use `shlex.join(...)`
instead of `" ".join(...)`
This commit is contained in:
Intel A80486DX2-66 2024-08-26 17:42:36 +03:00
parent e7e290b2f4
commit c6558c8c46
Signed by: 80486DX2-66
GPG Key ID: 83631EF27054609B

View File

@ -6,7 +6,7 @@ if __name__ == "__main__":
from argparse import ArgumentParser from argparse import ArgumentParser
from os import environ, makedirs, name as os_name from os import environ, makedirs, name as os_name
from os.path import exists, join as path_join from os.path import exists, join as path_join
from shlex import split as command_line_split from shlex import join as command_line_join, split as command_line_split
from shutil import which from shutil import which
from sys import stdin, stdout, exit from sys import stdin, stdout, exit
from typing import Dict, Union from typing import Dict, Union
@ -90,7 +90,7 @@ def substitute_vars(replacements: Dict[str, Union[bool, str]], text: str,
return text return text
def run_command(*command: list[str]) -> None: def run_command(*command: list[str]) -> None:
print(" ".join(command), flush=True) print(command_line_join(command), flush=True)
if subprocess.run(command).returncode != EXIT_SUCCESS: if subprocess.run(command).returncode != EXIT_SUCCESS:
exit(EXIT_FAILURE) exit(EXIT_FAILURE)