Skip to content

Commit 8bae7f4

Browse files
committed
Switch to using shlex.quote()
This isn't ideal on Windows, but subprocess.list2cmdline is private. As long as we're using the lit internal shell, the shlex quoting should work fine.
1 parent 7fd2461 commit 8bae7f4

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

libcxx/utils/libcxx/test/params.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,13 @@
77
# ===----------------------------------------------------------------------===##
88
import sys
99
import re
10-
import subprocess
10+
import shlex
1111
from pathlib import Path
1212

1313
from libcxx.test.dsl import *
1414
from libcxx.test.features import _isMSVC
1515

1616

17-
def quote(x):
18-
return subprocess.list2cmdline([x])
19-
20-
2117
_warningFlags = [
2218
"-Werror",
2319
"-Wall",
@@ -325,7 +321,7 @@ def getStdFlag(cfg, std):
325321
Parameter(
326322
name="executor",
327323
type=str,
328-
default=f"{quote(sys.executable)} {quote(str(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'))}",
329325
help="Custom executor to use instead of the configured default.",
330326
actions=lambda executor: [AddSubstitution("%{executor}", executor)],
331327
)

0 commit comments

Comments
 (0)