parameters: (command, verbose=True, collect_output=False,
                     print_output=True)
return_statement: return (proc.returncode, output)
docstring: Runs the command list.
  
    Prints the given command (which should be a list of one or more strings).
    If specified, prints its stderr (and optionally stdout) to stdout,
    line-buffered, converting line endings to CRLF (see note below).  If
    specified, collects the output as a list of lines and returns it.  Waits
    for the command to terminate and returns its status.
  
    Args:
      command: the full command to run, as a list of one or more strings
      verbose: if True, combines all output (stdout and stderr) into stdout.
               Otherwise, prints only the command's stderr to stdout.
      collect_output: if True, collects the output of the command as a list of
                      lines and returns it
      print_output: if True, prints the output of the command
  
    Returns:
      A tuple consisting of the process's exit status and output.  If
      collect_output is False, the output will be [].
  
    Raises:
      CommandNotFound if the command executable could not be found.
docstring_summary: Runs the command list.
docstring_tokens: Runs the command list .
function: def RunCommandFull(command, verbose=True, collect_output=False,
                     print_output=True):
    """Runs the command list.
  
    Prints the given command (which should be a list of one or more strings).
    If specified, prints its stderr (and optionally stdout) to stdout,
    line-buffered, converting line endings to CRLF (see note below).  If
    specified, collects the output as a list of lines and returns it.  Waits
    for the command to terminate and returns its status.
  
    Args:
      command: the full command to run, as a list of one or more strings
      verbose: if True, combines all output (stdout and stderr) into stdout.
               Otherwise, prints only the command's stderr to stdout.
      collect_output: if True, collects the output of the command as a list of
                      lines and returns it
      print_output: if True, prints the output of the command
  
    Returns:
      A tuple consisting of the process's exit status and output.  If
      collect_output is False, the output will be [].
  
    Raises:
      CommandNotFound if the command executable could not be found.
    """
    print '\n' + subprocess.list2cmdline(command).replace('\\', '/') + '\n', ###
  
    if verbose:
      out = subprocess.PIPE
      err = subprocess.STDOUT
    else:
      out = file(os.devnull, 'w')
      err = subprocess.PIPE
    try:
      proc = subprocess.Popen(command, stdout=out, stderr=err, bufsize=1)
    except OSError, e:
      if e.errno == errno.ENOENT:
        raise CommandNotFound('Unable to find "%s"' % command[0])
      raise
  
    output = []
  
    if verbose:
      read_from = proc.stdout
    else:
      read_from = proc.stderr
    line = read_from.readline()
    while line:
      line = line.rstrip()
  
      if collect_output:
        output.append(line)
  
      if print_output:
        # Windows Python converts \n to \r\n automatically whenever it
        # encounters it written to a text file (including stdout).  The only
        # way around it is to write to a binary file, which isn't feasible for
        # stdout. So we end up with \r\n here even though we explicitly write
        # \n.  (We could write \r instead, which doesn't get converted to \r\n,
        # but that's probably more troublesome for people trying to read the
        # files.)
        print line + '\n',
  
        # Python on windows writes the buffer only when it reaches 4k. This is
        # not fast enough for all purposes.
        sys.stdout.flush()
      line = read_from.readline()
  
    # Make sure the process terminates.
    proc.wait()
  
    if not verbose:
      out.close()
    return (proc.returncode, output)
function_tokens: def RunCommandFull ( command , verbose = True , collect_output = False , print_output = True ) : print '\n' + subprocess . list2cmdline ( command ) . replace ( '\\' , '/' ) + '\n' , ### if verbose : out = subprocess . PIPE err = subprocess . STDOUT else : out = file ( os . devnull , 'w' ) err = subprocess . PIPE try : proc = subprocess . Popen ( command , stdout = out , stderr = err , bufsize = 1 ) except OSError , e : if e . errno == errno . ENOENT : raise CommandNotFound ( 'Unable to find "%s"' % command [ 0 ] ) raise output = [ ] if verbose : read_from = proc . stdout else : read_from = proc . stderr line = read_from . readline ( ) while line : line = line . rstrip ( ) if collect_output : output . append ( line ) if print_output : # Windows Python converts \n to \r\n automatically whenever it # encounters it written to a text file (including stdout).  The only # way around it is to write to a binary file, which isn't feasible for # stdout. So we end up with \r\n here even though we explicitly write # \n.  (We could write \r instead, which doesn't get converted to \r\n, # but that's probably more troublesome for people trying to read the # files.) print line + '\n' , # Python on windows writes the buffer only when it reaches 4k. This is # not fast enough for all purposes. sys . stdout . flush ( ) line = read_from . readline ( ) # Make sure the process terminates. proc . wait ( ) if not verbose : out . close ( ) return ( proc . returncode , output )