From a53735f01832cce539dde5fe453cacf2c76b9a1c Mon Sep 17 00:00:00 2001 From: Paul O'Leary McCann Date: Fri, 2 Sep 2022 13:33:30 +0900 Subject: [PATCH] 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. --- spacy/util.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/spacy/util.py b/spacy/util.py index fd6e5ea46..20f95eb66 100644 --- a/spacy/util.py +++ b/spacy/util.py @@ -972,7 +972,9 @@ def run_command( cmd_str = command else: 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: cmd_to_run = command if is_windows else cmd_list ret = subprocess.run(