def git(*args, **kwargs):
    """
    Execute a Git command.  Raises GitError on non-zero exits unless the
    raise_exc keyword argument is falsey.
    """
    try:
        p = subprocess.Popen(git_args() + list(args),
                             close_fds=True,
                             preexec_fn=unroot,
                             stdin=subprocess.PIPE,
                             stdout=subprocess.PIPE)
    except __HOLE__:
        logging.error('git not found on PATH - exiting')
        sys.exit(1)
    stdout, stderr = p.communicate(kwargs.get('stdin'))
    if 0 != p.returncode and kwargs.get('raise_exc', True):
        raise GitError(p.returncode)
    return p.returncode, stdout
dataset/ETHPy150Open devstructure/blueprint/blueprint/git.py/git