Use shlex.join in run_command

Previously the command string was built by joining with a space, which
wouldn't work for anything requiring quotes. The command string built
this way is only used for debugging purposes, but shlex.join will be
always be valid on Linux, and will usually be valid in Windows. It's
unclear how to do better on Windows.
This commit is contained in:
Paul O'Leary McCann 2022-09-02 13:33:30 +09:00
parent 2fe360d7f3
commit a53735f018

View File

@ -972,7 +972,9 @@ def run_command(
cmd_str = command cmd_str = command
else: else:
cmd_list = command cmd_list = command
cmd_str = " ".join(command) # As above, this will usually but not always be correct on Windows, but
# is only used for debugging purposes.
cmd_str = shlex.join(command)
try: try:
cmd_to_run = command if is_windows else cmd_list cmd_to_run = command if is_windows else cmd_list
ret = subprocess.run( ret = subprocess.run(