diff options
author | 2018-03-13 15:38:11 -0700 | |
---|---|---|
committer | 2018-03-13 15:41:42 -0700 | |
commit | 99d8f895c03ce30f77c43d4db125424d45ce5286 (patch) | |
tree | 4e3a3ce2dfb1f7f9896a258349837b04e5a42014 | |
parent | 4bfca1cc7bf6c213b546ee20a6f2e131fca4831c (diff) |
Make wrap-logcat a bit easier to call.
Allow the command to be sent in as a non-quoted string.
Test: ./tools/wrap-logcat.py -o /tmp/abc.txt ./test/run-test 001-Main
Change-Id: Ia35c2090c7f0ad8b12ff913a3e1d608e01a56845
-rwxr-xr-x | tools/wrap-logcat.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/tools/wrap-logcat.py b/tools/wrap-logcat.py index 91bbb25c49..067890e870 100755 --- a/tools/wrap-logcat.py +++ b/tools/wrap-logcat.py @@ -35,8 +35,13 @@ def main(): finishes.""") parser.add_argument('command', action='store', + nargs=argparse.REMAINDER, help='The command to run with logcat in the background.') args = parser.parse_args() + if len(args.command) == 0: + print("Must have some command to run.", file=sys.stderr) + parser.print_help(file=sys.stderr) + return 1 # Send all output from logcat to the file. with subprocess.Popen(shlex.split(args.logcat_invoke), stdout=args.output, @@ -44,7 +49,7 @@ def main(): shell=False, universal_newlines=True) as logcat_proc: # Let the run-test-proc inherit our stdout FDs - with subprocess.Popen(shlex.split(args.command), + with subprocess.Popen(shlex.split(args.command[0]) if len(args.command) == 1 else args.command, stdout=None, stderr=None, shell=False) as run_test_proc: |