Skip to content

Commit 7fd2461

Browse files
committed
Switch to using a proper quote function
Don't use shlex.quote(), that's documented to only be relevant for Unix (and it uses single quotes which aren't normally tolerated by windows shells - even if the lit internal shell does handle them). Additionally, shlex.quote() always quotes paths that include backslashes, even if those don't need quoting on Windows.
1 parent 1a46cc3 commit 7fd2461

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

libcxx/utils/libcxx/test/params.py

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

1213
from libcxx.test.dsl import *
1314
from libcxx.test.features import _isMSVC
1415

1516

17+
def quote(x):
18+
return subprocess.list2cmdline([x])
19+
20+
1621
_warningFlags = [
1722
"-Werror",
1823
"-Wall",
@@ -320,7 +325,7 @@ def getStdFlag(cfg, std):
320325
Parameter(
321326
name="executor",
322327
type=str,
323-
default=f"\"{sys.executable}\" {Path(__file__).resolve().parent.parent.parent / 'run.py'}",
328+
default=f"{quote(sys.executable)} {quote(str(Path(__file__).resolve().parent.parent.parent / 'run.py'))}",
324329
help="Custom executor to use instead of the configured default.",
325330
actions=lambda executor: [AddSubstitution("%{executor}", executor)],
326331
)

0 commit comments

Comments
 (0)