parameters: (command_line, working_dir, depot_tools_dir=None, output_file=None)
docstring: Runs the specified command.
docstring_summary: Runs the specified command.
docstring_tokens: Runs the specified command .
function: def run(command_line, working_dir, depot_tools_dir=None, output_file=None):
    """ Runs the specified command. """
    # add depot_tools to the path
    env = os.environ
    if not depot_tools_dir is None:
      env['PATH'] = depot_tools_dir + os.pathsep + env['PATH']
  
    sys.stdout.write('-------- Running "'+command_line+'" in "'+\
                     working_dir+'"...'+"\n")
    if not options.dryrun:
      args = shlex.split(command_line.replace('\\', '\\\\'))
  
      if not output_file:
        return subprocess.check_call(
            args, cwd=working_dir, env=env, shell=(sys.platform == 'win32'))
      try:
        msg('Writing %s' % output_file)
        with open(output_file, 'w', encoding='utf-8') as fp:
          return subprocess.check_call(
              args,
              cwd=working_dir,
              env=env,
              shell=(sys.platform == 'win32'),
              stderr=subprocess.STDOUT,
              stdout=fp)
      except subprocess.CalledProcessError:
        msg('ERROR Run failed. See %s for output.' % output_file)
        raise
function_tokens: def run ( command_line , working_dir , depot_tools_dir = None , output_file = None ) : # add depot_tools to the path env = os . environ if not depot_tools_dir is None : env [ 'PATH' ] = depot_tools_dir + os . pathsep + env [ 'PATH' ] sys . stdout . write ( '-------- Running "' + command_line + '" in "' + working_dir + '"...' + "\n" ) if not options . dryrun : args = shlex . split ( command_line . replace ( '\\' , '\\\\' ) ) if not output_file : return subprocess . check_call ( args , cwd = working_dir , env = env , shell = ( sys . platform == 'win32' ) ) try : msg ( 'Writing %s' % output_file ) with open ( output_file , 'w' , encoding = 'utf-8' ) as fp : return subprocess . check_call ( args , cwd = working_dir , env = env , shell = ( sys . platform == 'win32' ) , stderr = subprocess . STDOUT , stdout = fp ) except subprocess . CalledProcessError : msg ( 'ERROR Run failed. See %s for output.' % output_file ) raise