提交 cc090e19 authored 作者: Ben Mares's avatar Ben Mares 提交者: Michael Osthege

Use shlex.join for converting commands to strings

...in print statements
上级 e3a05bba
...@@ -10,6 +10,7 @@ import os ...@@ -10,6 +10,7 @@ import os
import pickle import pickle
import platform import platform
import re import re
import shlex
import shutil import shutil
import stat import stat
import subprocess import subprocess
...@@ -2610,7 +2611,7 @@ class GCC_compiler(Compiler): ...@@ -2610,7 +2611,7 @@ class GCC_compiler(Compiler):
cmd.append(f"{path_wrapper}{cppfilename}{path_wrapper}") cmd.append(f"{path_wrapper}{cppfilename}{path_wrapper}")
cmd.extend(GCC_compiler.linking_patch(lib_dirs, libs)) cmd.extend(GCC_compiler.linking_patch(lib_dirs, libs))
# print >> sys.stderr, 'COMPILING W CMD', cmd # print >> sys.stderr, 'COMPILING W CMD', cmd
_logger.debug(f"Running cmd: {' '.join(cmd)}") _logger.debug(f"Running cmd: {shlex.join(cmd)}")
def print_command_line_error(): def print_command_line_error():
# Print command line when a problem occurred. # Print command line when a problem occurred.
...@@ -2618,7 +2619,7 @@ class GCC_compiler(Compiler): ...@@ -2618,7 +2619,7 @@ class GCC_compiler(Compiler):
("Problem occurred during compilation with the command line below:"), ("Problem occurred during compilation with the command line below:"),
file=sys.stderr, file=sys.stderr,
) )
print(" ".join(cmd), file=sys.stderr) print(shlex.join(cmd), file=sys.stderr)
try: try:
p_out = output_subprocess_Popen(cmd) p_out = output_subprocess_Popen(cmd)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论