Index: build/android/pylib/cmd_helper.py |
diff --git a/build/android/pylib/cmd_helper.py b/build/android/pylib/cmd_helper.py |
index e9102411a6c71acdf85d3d7e7677ff7b5f18ecb1..69889d2e7bd7789aecc11b8f4201ba8f016623fc 100644 |
--- a/build/android/pylib/cmd_helper.py |
+++ b/build/android/pylib/cmd_helper.py |
@@ -67,7 +67,20 @@ def GetCmdStatusAndOutput(args, cwd=None, shell=False): |
Returns: |
The tuple (exit code, output). |
""" |
- logging.info(str(args) + ' ' + (cwd or '')) |
+ if isinstance(args, basestring): |
+ args_repr = args |
+ if not shell: |
+ raise Exception('string args must be run with shell=True') |
+ elif shell: |
+ raise Exception('array args must be run with shell=False') |
+ else: |
+ args_repr = ' '.join(args) |
Isaac (away)
2013/04/10 19:12:53
maybe use ' '.join(map(pipes.quote, args))
This w
frankf
2013/04/10 21:29:42
Done. Although the doc says it's deprecated.
|
+ |
+ s = '[host]' |
+ if cwd: |
+ s += ':' + cwd |
+ s += '> ' + args_repr |
+ logging.info(s) |
Isaac (away)
2013/04/10 19:12:53
put this and the join behind a guard that checks l
craigdh
2013/04/10 20:39:49
I don't think the code complexity tradeoff is wort
frankf
2013/04/10 21:29:42
Agreed.
On 2013/04/10 20:39:49, craigdh wrote:
|
tmpout = tempfile.TemporaryFile(bufsize=0) |
tmperr = tempfile.TemporaryFile(bufsize=0) |
exit_code = _Call(args, cwd=cwd, stdout=tmpout, stderr=tmperr, shell=shell) |
@@ -79,7 +92,7 @@ def GetCmdStatusAndOutput(args, cwd=None, shell=False): |
tmpout.seek(0) |
stdout = tmpout.read() |
tmpout.close() |
- logging.info(stdout[:4096]) # Truncate output longer than 4k. |
+ logging.debug(stdout[:4096]) # Truncate output longer than 4k. |
craigdh
2013/04/10 20:39:49
maybe append a note that the output was truncated
frankf
2013/04/10 21:29:42
Done.
|
return (exit_code, stdout) |