aboutsummaryrefslogtreecommitdiff
path: root/build
diff options
context:
space:
mode:
authorMatthias Blume <blume@google.com>2022-05-21 01:36:50 +0000
committerMatthias Blume <blume@google.com>2022-05-26 18:15:41 +0000
commit0f5474ef9a6b03faff4c4b357fcfd00b743c3e89 (patch)
tree16bfd06c8e06414c37eed5adc62ae89c5896473b /build
parent62c1d444e10dfe35d0981c4ab17ef1afc294a772 (diff)
downloadndk-0f5474ef9a6b03faff4c4b357fcfd00b743c3e89.tar.gz
Adding shell quotations around fragile arguments.
Modifies dump_compile_commands.py to have it add shell escapes to command line arguments where needed. Currently this does not support APP_SHORT_COMMANDS set to true. That will be done in a separate change. Bug: https://github.com/android/ndk/issues/1334 Change-Id: Ieb8d421b938c58510eaadc37c7a83cc6a070908d
Diffstat (limited to 'build')
-rw-r--r--build/dump_compile_commands.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/build/dump_compile_commands.py b/build/dump_compile_commands.py
index f65f02f74..39ab68a35 100644
--- a/build/dump_compile_commands.py
+++ b/build/dump_compile_commands.py
@@ -24,6 +24,7 @@ import argparse
import json
import os
+from shlex import join
def get_argument_parser() -> argparse.ArgumentParser:
"""Parses and returns command line arguments."""
@@ -71,7 +72,7 @@ def main() -> None:
if not args.command_file and not args.compile_command:
parser.error('Either --command-file or COMPILE_COMMAND is required.')
- command = ' '.join(args.compile_command)
+ command = join(args.compile_command)
if args.command_file:
with open(args.command_file) as command_file:
command = command_file.read().strip()