| Index: build/android/pylib/cmd_helper.py | 
| diff --git a/build/android/pylib/cmd_helper.py b/build/android/pylib/cmd_helper.py | 
| index 8b501309060bc5943afbc9c7e96fb1ce97eac397..46b6981195ebcecf9b2ed43c1d13eace39d4b00a 100644 | 
| --- a/build/android/pylib/cmd_helper.py | 
| +++ b/build/android/pylib/cmd_helper.py | 
| @@ -40,11 +40,28 @@ def GetCmdOutput(args, cwd=None, shell=False): | 
| Captures and returns the command's stdout. | 
| Prints the command's stderr to logger (which defaults to stdout). | 
| """ | 
| +  (_, output) = GetCmdStatusAndOutput(args, cwd, shell) | 
| +  return output | 
| + | 
| +def GetCmdStatusAndOutput(args, cwd=None, shell=False): | 
| +  """Executes a subprocess and returns its exit code and output. | 
| + | 
| +  Args: | 
| +    args: A string or a sequence of program arguments. The program to execute is | 
| +      the string or the first item in the args sequence. | 
| +    cwd: If not None, the subprocess's current directory will be changed to | 
| +      |cwd| before it's executed. | 
| +    shell: Whether to execute args as a shell command. | 
| + | 
| +  Returns: | 
| +    The tuple (exit code, output). | 
| +  """ | 
| logging.info(str(args) + ' ' + (cwd or '')) | 
| p = subprocess.Popen(args=args, cwd=cwd, stdout=subprocess.PIPE, | 
| stderr=subprocess.PIPE, shell=shell) | 
| stdout, stderr = p.communicate() | 
| +  exit_code = p.returncode | 
| if stderr: | 
| logging.critical(stderr) | 
| logging.info(stdout[:4096])  # Truncate output longer than 4k. | 
| -  return stdout | 
| +  return (exit_code, stdout) | 
|  |