tools/perf/core/cli_helpers.py
def CheckLog(command, log_path, env=None):
  """Executes a command and writes its stdout to a specified log file.

  On non-zero return value, also prints the content of the file to the screen
  and raises subprocess.CalledProcessError.

  Args:
    command: Command to be run as a list of arguments.
    log_path: Path to a file to which the output will be written.
    env: Environment to run the command in.
  """
  with open(log_path, 'w') as f:
    try:
      cmd_str = (' '.join(pipes.quote(c) for c in command)
                 if isinstance(command, list) else command)
      print(Colored(cmd_str, 'blue'))
      print(Colored('Logging stdout & stderr to %s' % log_path, 'blue'))
      subprocess.check_call(
          command, stdout=f, stderr=subprocess.STDOUT, shell=False, env=env)
    except subprocess.CalledProcessError:
      Error('=' * 80)
      Error('Received non-zero return code. Log content:')
      Error('=' * 80)
      subprocess.call(['cat', log_path])
      Error('=' * 80)
      raise
Executes a command and writes its stdout to a specified log file.

  On non-zero return value, also prints the content of the file to the screen
  and raises subprocess.CalledProcessError.

  Args:
    command: Command to be run as a list of arguments.
    log_path: Path to a file to which the output will be written.
    env: Environment to run the command in.
  
Executes a command and writes its stdout to a specified log file.
On non-zero return value, also prints the content of the file to the screen
and raises subprocess.CalledProcessError.
Executes a command and writes its stdout to a specified log file . On non - zero return value also prints the content of the file to the screen and raises subprocess . CalledProcessError .
def CheckLog(command, log_path, env=None):
  with open(log_path, 'w') as f:
    try:
      cmd_str = (' '.join(pipes.quote(c) for c in command)
                 if isinstance(command, list) else command)
      print(Colored(cmd_str, 'blue'))
      print(Colored('Logging stdout & stderr to %s' % log_path, 'blue'))
      subprocess.check_call(
          command, stdout=f, stderr=subprocess.STDOUT, shell=False, env=env)
    except subprocess.CalledProcessError:
      Error('=' * 80)
      Error('Received non-zero return code. Log content:')
      Error('=' * 80)
      subprocess.call(['cat', log_path])
      Error('=' * 80)
      raise
def CheckLog ( command , log_path , env = None ) : with open ( log_path , 'w' ) as f : try : cmd_str = ( ' ' . join ( pipes . quote ( c ) for c in command ) if isinstance ( command , list ) else command ) print ( Colored ( cmd_str , 'blue' ) ) print ( Colored ( 'Logging stdout & stderr to %s' % log_path , 'blue' ) ) subprocess . check_call ( command , stdout = f , stderr = subprocess . STDOUT , shell = False , env = env ) except subprocess . CalledProcessError : Error ( '=' * 80 ) Error ( 'Received non-zero return code. Log content:' ) Error ( '=' * 80 ) subprocess . call ( [ 'cat' , log_path ] ) Error ( '=' * 80 ) raise
Executes a command and writes its stdout to a specified log file.
Executes a command and writes its stdout to a specified log file .
"""Executes a command and writes its stdout to a specified log file.

  On non-zero return value, also prints the content of the file to the screen
  and raises subprocess.CalledProcessError.

  Args:
    command: Command to be run as a list of arguments.
    log_path: Path to a file to which the output will be written.
    env: Environment to run the command in.
  """
command
Command to be run as a list of arguments.
Command to be run as a list of arguments .
log_path
Path to a file to which the output will be written.
Path to a file to which the output will be written .
env
Environment to run the command in.
Environment to run the command in .