Skip to content

Commit b9f13c7

Browse files
committed
Use shlex.join for converting commands to strings
...in print statements
1 parent 39c8b7c commit b9f13c7

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

pytensor/link/c/cmodule.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import pickle
1111
import platform
1212
import re
13+
import shlex
1314
import shutil
1415
import stat
1516
import subprocess
@@ -2610,15 +2611,15 @@ def compile_str(
26102611
cmd.append(f"{path_wrapper}{cppfilename}{path_wrapper}")
26112612
cmd.extend(GCC_compiler.linking_patch(lib_dirs, libs))
26122613
# print >> sys.stderr, 'COMPILING W CMD', cmd
2613-
_logger.debug(f"Running cmd: {' '.join(cmd)}")
2614+
_logger.debug(f"Running cmd: {shlex.join(cmd)}")
26142615

26152616
def print_command_line_error():
26162617
# Print command line when a problem occurred.
26172618
print(
26182619
("Problem occurred during compilation with the command line below:"),
26192620
file=sys.stderr,
26202621
)
2621-
print(" ".join(cmd), file=sys.stderr)
2622+
print(shlex.join(cmd), file=sys.stderr)
26222623

26232624
try:
26242625
p_out = output_subprocess_Popen(cmd)

0 commit comments

Comments
 (0)