Skip to content

Commit 5e3f43e

Browse files
authored
[libcxx] [test] Quote the python executable in the executor (#68208)
This reapplies the change from c218c80, which was lost in the refactoring in 78d649a. On Windows, the Python interpreter is by default installed in a path like "C:\Program Files\Python38\python.exe", which requires quoting when included in a concatenated command string (as opposed to a command list, where each argument is a separate element). This doesn't show up in the CI environments as they use Python installed in a different directory, like C:\Python. In addition to the python executable, also quote the path to run.py, if needed.
1 parent b9c6737 commit 5e3f43e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

libcxx/utils/libcxx/test/params.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
# ===----------------------------------------------------------------------===##
88
import sys
99
import re
10+
import shlex
1011
from pathlib import Path
1112

1213
from libcxx.test.dsl import *
@@ -320,7 +321,7 @@ def getStdFlag(cfg, std):
320321
Parameter(
321322
name="executor",
322323
type=str,
323-
default=f"{sys.executable} {Path(__file__).resolve().parent.parent.parent / 'run.py'}",
324+
default=f"{shlex.quote(sys.executable)} {shlex.quote(str(Path(__file__).resolve().parent.parent.parent / 'run.py'))}",
324325
help="Custom executor to use instead of the configured default.",
325326
actions=lambda executor: [AddSubstitution("%{executor}", executor)],
326327
)

0 commit comments

Comments
 (0)