parameters: (command, working_dir=None, ignore_exit_code=False,
                  extra_env=None)
return_statement: return std_output, err_output
docstring: Runs a command and returns the output from that command.
  
    If the command fails (exit code != 0), the function will exit the process.
  
    Returns:
      A tuple containing the stdout and stderr outputs as strings.
docstring_summary: Runs a command and returns the output from that command.
docstring_tokens: Runs a command and returns the output from that command .
function: def _RunCommand(command, working_dir=None, ignore_exit_code=False,
                  extra_env=None):
    """Runs a command and returns the output from that command.
  
    If the command fails (exit code != 0), the function will exit the process.
  
    Returns:
      A tuple containing the stdout and stderr outputs as strings.
    """
    working_dir = working_dir or CHECKOUT_SRC_DIR
    logging.debug('CMD: %s CWD: %s', ' '.join(command), working_dir)
    env = os.environ.copy()
    if extra_env:
      assert all(type(value) == str for value in extra_env.values())
      logging.debug('extra env: %s', extra_env)
      env.update(extra_env)
    p = subprocess.Popen(command, stdout=subprocess.PIPE,
                         stderr=subprocess.PIPE, env=env,
                         cwd=working_dir, universal_newlines=True)
    std_output = p.stdout.read()
    err_output = p.stderr.read()
    p.wait()
    p.stdout.close()
    p.stderr.close()
    if not ignore_exit_code and p.returncode != 0:
      logging.error('Command failed: %s\n'
                    'stdout:\n%s\n'
                    'stderr:\n%s\n', ' '.join(command), std_output, err_output)
      sys.exit(p.returncode)
    return std_output, err_output
function_tokens: def _RunCommand ( command , working_dir = None , ignore_exit_code = False , extra_env = None ) : working_dir = working_dir or CHECKOUT_SRC_DIR logging . debug ( 'CMD: %s CWD: %s' , ' ' . join ( command ) , working_dir ) env = os . environ . copy ( ) if extra_env : assert all ( type ( value ) == str for value in extra_env . values ( ) ) logging . debug ( 'extra env: %s' , extra_env ) env . update ( extra_env ) p = subprocess . Popen ( command , stdout = subprocess . PIPE , stderr = subprocess . PIPE , env = env , cwd = working_dir , universal_newlines = True ) std_output = p . stdout . read ( ) err_output = p . stderr . read ( ) p . wait ( ) p . stdout . close ( ) p . stderr . close ( ) if not ignore_exit_code and p . returncode != 0 : logging . error ( 'Command failed: %s\n' 'stdout:\n%s\n' 'stderr:\n%s\n' , ' ' . join ( command ) , std_output , err_output ) sys . exit ( p . returncode ) return std_output , err_output