Skip to content

Commit 766dbd2

Browse files
committed
review: use shlex.split.
Signed-off-by: Piotr Sikora <piotrsikora@google.com>
1 parent 068d04c commit 766dbd2

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

bazel/cc_wrapper.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/usr/bin/python
22
import contextlib
33
import os
4+
import shlex
45
import sys
56
import tempfile
67

@@ -29,7 +30,7 @@ def sanitize_flagfile(in_path, out_fd):
2930
def main():
3031
# Append CXXFLAGS to correctly detect include paths for either libstdc++ or libc++.
3132
if sys.argv[1:5] == ["-E", "-xc++", "-", "-v"]:
32-
os.execv(envoy_real_cxx, [envoy_real_cxx] + sys.argv[1:] + envoy_cxxflags.split(" "))
33+
os.execv(envoy_real_cxx, [envoy_real_cxx] + sys.argv[1:] + shlex.split(envoy_cxxflags))
3334

3435
# `g++` and `gcc -lstdc++` have similar behavior and Bazel treats them as
3536
# interchangeable, but `gcc` will ignore the `-static-libstdc++` flag.
@@ -49,7 +50,7 @@ def main():
4950
if "-static-libstdc++" in sys.argv[1:] or "-stdlib=libc++" in envoy_cxxflags:
5051
# Append CXXFLAGS to all C++ targets (this is mostly for dependencies).
5152
if envoy_cxxflags and "-std=c++" in str(sys.argv[1:]):
52-
argv = envoy_cxxflags.split(" ")
53+
argv = shlex.split(envoy_cxxflags)
5354
else:
5455
argv = []
5556
for arg in sys.argv[1:]:

0 commit comments

Comments
 (0)