tools/binary_size/diagnose_bloat.py
def _RunCmd(cmd, cwd=None, verbose=False, exit_on_failure=True):
  """Convenience function for running commands.

  Args:
    cmd: the command to run.
    verbose: if this is True, then the stdout and stderr of the process will be
        printed. If it's false, the stdout will be returned.
    exit_on_failure: die if an error occurs when this is True.

  Returns:
    Tuple of (process stdout, process returncode).
  """
  assert not (verbose and exit_on_failure)
  cmd_str = ' '.join(c for c in cmd)
  logging.debug('Running: %s', cmd_str)
  proc_stdout = proc_stderr = subprocess.PIPE
  if verbose:
    proc_stdout, proc_stderr = sys.stdout, subprocess.STDOUT

  # pylint: disable=unexpected-keyword-arg
  proc = subprocess.Popen(cmd,
                          cwd=cwd,
                          stdout=proc_stdout,
                          stderr=proc_stderr,
                          encoding='utf-8')
  stdout, stderr = proc.communicate()

  if proc.returncode and exit_on_failure:
    _Die('command failed: %s\nstderr:\n%s', cmd_str, stderr)

  stdout = stdout.strip() if stdout else ''
  return stdout, proc.returncode
Convenience function for running commands.

  Args:
    cmd: the command to run.
    verbose: if this is True, then the stdout and stderr of the process will be
        printed. If it's false, the stdout will be returned.
    exit_on_failure: die if an error occurs when this is True.

  Returns:
    Tuple of (process stdout, process returncode).
  
Convenience function for running commands.
Convenience function for running commands .
def _RunCmd(cmd, cwd=None, verbose=False, exit_on_failure=True):
  assert not (verbose and exit_on_failure)
  cmd_str = ' '.join(c for c in cmd)
  logging.debug('Running: %s', cmd_str)
  proc_stdout = proc_stderr = subprocess.PIPE
  if verbose:
    proc_stdout, proc_stderr = sys.stdout, subprocess.STDOUT
  proc = subprocess.Popen(cmd,
                          cwd=cwd,
                          stdout=proc_stdout,
                          stderr=proc_stderr,
                          encoding='utf-8')
  stdout, stderr = proc.communicate()
  if proc.returncode and exit_on_failure:
    _Die('command failed: %s\nstderr:\n%s', cmd_str, stderr)
  stdout = stdout.strip() if stdout else ''
  return stdout, proc.returncode
def _RunCmd ( cmd , cwd = None , verbose = False , exit_on_failure = True ) : assert not ( verbose and exit_on_failure ) cmd_str = ' ' . join ( c for c in cmd ) logging . debug ( 'Running: %s' , cmd_str ) proc_stdout = proc_stderr = subprocess . PIPE if verbose : proc_stdout , proc_stderr = sys . stdout , subprocess . STDOUT proc = subprocess . Popen ( cmd , cwd = cwd , stdout = proc_stdout , stderr = proc_stderr , encoding = 'utf-8' ) stdout , stderr = proc . communicate ( ) if proc . returncode and exit_on_failure : _Die ( 'command failed: %s\nstderr:\n%s' , cmd_str , stderr ) stdout = stdout . strip ( ) if stdout else '' return stdout , proc . returncode
Convenience function for running commands.
Convenience function for running commands .
"""Convenience function for running commands.

  Args:
    cmd: the command to run.
    verbose: if this is True, then the stdout and stderr of the process will be
        printed. If it's false, the stdout will be returned.
    exit_on_failure: die if an error occurs when this is True.

  Returns:
    Tuple of (process stdout, process returncode).
  """ # pylint: disable=unexpected-keyword-arg
Tuple of (process stdout, process returncode).
Tuple of ( process stdout process returncode ) .
cmd
the command to run.
the command to run .
cwd
verbose
if this is True, then the stdout and stderr of the process will be
printed. If it's false, the stdout will be returned.
if this is True then the stdout and stderr of the process will be printed . If it ' s false the stdout will be returned .
exit_on_failure
die if an error occurs when this is True.
die if an error occurs when this is True .