def call(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
         on_error='ignore', returncode=False):
    """Run the given command (with shell=False) and return the output as a
    string.

    Strips the output of enclosing whitespace.

    If the return code is non-zero, throw GitInvocationError.
    """
    # start external command process
    p = subprocess.Popen(command, stdout=subprocess.PIPE,
                         stderr=subprocess.PIPE)

    # get outputs
    out, _ = p.communicate()

    # throw exception if process failed
    if p.returncode != 0 and on_error == 'raise':
        raise GitInvocationError('Failed to run "%s"' % " ".join(command))

    if returncode:
        return out.strip(), p.returncode
    else:
        return out.strip()
def call ( command , stdout = subprocess . PIPE , stderr = subprocess . PIPE , on_error = 'ignore' , returncode = False ) : p = subprocess . Popen ( command , stdout = subprocess . PIPE , stderr = subprocess . PIPE ) out , _ = p . communicate ( ) if p . returncode != 0 and on_error == 'raise' : raise GitInvocationError ( 'Failed to run "%s"' % " " . join ( command ) ) if returncode : return out . strip ( ) , p . returncode else : return out . strip ( )
Run the given command (with shell=False) and return the output as a
    string.

    Strips the output of enclosing whitespace.

    If the return code is non-zero, throw GitInvocationError.