tools/fuchsia/comparative_tester/comparative_tester.py
def RunCommand(command: List[str], msg: str) -> str:
  """Runs a command and returns the standard output.

  Args:
    command (List[str]): The list of command chunks to use in subprocess.run.
        ex: ['git', 'grep', 'cat'] to find all instances of cat in a repo.
    msg (str): An error message in case the subprocess fails for some reason.

  Raises:
    subprocess.SubprocessError: Raises this with the command that failed in the
        event that the return code of the process is non-zero.

  Returns:
    str: the standard output of the subprocess.
  """
  command = [piece for piece in command if piece != ""]
  proc = subprocess.run(
      command,
      stdout=subprocess.PIPE,
      stderr=subprocess.PIPE,
      stdin=subprocess.DEVNULL)
  out = proc.stdout.decode("utf-8", errors="ignore")
  err = proc.stderr.decode("utf-8", errors="ignore")
  if proc.returncode != 0:
    sys.stderr.write("{}\nreturn code: {}\nstdout: {}\nstderr: {}".format(
        msg, proc.returncode, out, err))
    raise subprocess.SubprocessError(
        "Command failed to complete successfully. {}".format(command))
  return out
Runs a command and returns the standard output.

  Args:
    command (List[str]): The list of command chunks to use in subprocess.run.
        ex: ['git', 'grep', 'cat'] to find all instances of cat in a repo.
    msg (str): An error message in case the subprocess fails for some reason.

  Raises:
    subprocess.SubprocessError: Raises this with the command that failed in the
        event that the return code of the process is non-zero.

  Returns:
    str: the standard output of the subprocess.
  
Runs a command and returns the standard output.
Runs a command and returns the standard output .
def RunCommand(command: List[str], msg: str) -> str:
  command = [piece for piece in command if piece != ""]
  proc = subprocess.run(
      command,
      stdout=subprocess.PIPE,
      stderr=subprocess.PIPE,
      stdin=subprocess.DEVNULL)
  out = proc.stdout.decode("utf-8", errors="ignore")
  err = proc.stderr.decode("utf-8", errors="ignore")
  if proc.returncode != 0:
    sys.stderr.write("{}\nreturn code: {}\nstdout: {}\nstderr: {}".format(
        msg, proc.returncode, out, err))
    raise subprocess.SubprocessError(
        "Command failed to complete successfully. {}".format(command))
  return out
def RunCommand ( command : List [ str ] , msg : str ) -> str : command = [ piece for piece in command if piece != "" ] proc = subprocess . run ( command , stdout = subprocess . PIPE , stderr = subprocess . PIPE , stdin = subprocess . DEVNULL ) out = proc . stdout . decode ( "utf-8" , errors = "ignore" ) err = proc . stderr . decode ( "utf-8" , errors = "ignore" ) if proc . returncode != 0 : sys . stderr . write ( "{}\nreturn code: {}\nstdout: {}\nstderr: {}" . format ( msg , proc . returncode , out , err ) ) raise subprocess . SubprocessError ( "Command failed to complete successfully. {}" . format ( command ) ) return out
Runs a command and returns the standard output.
Runs a command and returns the standard output .
"""Runs a command and returns the standard output.

  Args:
    command (List[str]): The list of command chunks to use in subprocess.run.
        ex: ['git', 'grep', 'cat'] to find all instances of cat in a repo.
    msg (str): An error message in case the subprocess fails for some reason.

  Raises:
    subprocess.SubprocessError: Raises this with the command that failed in the
        event that the return code of the process is non-zero.

  Returns:
    str: the standard output of the subprocess.
  """
the standard output of the subprocess.
the standard output of the subprocess .
str
Raises this with the command that failed in the
event that the return code of the process is non-zero.
Raises this with the command that failed in the event that the return code of the process is non - zero .
subprocess.SubprocessError
command
List[str]
The list of command chunks to use in subprocess.run.
ex: ['git', 'grep', 'cat'] to find all instances of cat in a repo.
The list of command chunks to use in subprocess . run . ex : [ ' git ' ' grep ' ' cat ' ] to find all instances of cat in a repo .
msg
str
An error message in case the subprocess fails for some reason.
An error message in case the subprocess fails for some reason .