Index: tools/compile_test/compile_test.py |
diff --git a/tools/compile_test/compile_test.py b/tools/compile_test/compile_test.py |
index 79371a1fd05d2e03e098340527fc897faadad54c..bbda4abfe54f327aabede26f400bebd5e1376d82 100755 |
--- a/tools/compile_test/compile_test.py |
+++ b/tools/compile_test/compile_test.py |
@@ -30,7 +30,9 @@ def DoMain(argv): |
if not options.code: |
parser.error('Missing required --code switch.') |
- cxx = os.environ.get('CXX', 'g++') |
+ # The environment variable might expand to a string with spaces, |
+ # e.g. "ccache g++". Convert it to a list suitable for argv. |
+ cxx = os.environ.get('CXX', 'g++').split() |
tmpdir = tempfile.mkdtemp() |
try: |
@@ -40,7 +42,7 @@ def DoMain(argv): |
o_path = os.path.join(tmpdir, 'test.o') |
- cxx_cmdline = [cxx, cxx_path, '-o', o_path] |
+ cxx_cmdline = cxx + [cxx_path, '-o', o_path] |
if not options.run_linker: |
cxx_cmdline.append('-c') |
# Pass remaining arguments to the compiler. |