

def run_command_status(*argv, **kwargs):
    if VERBOSE:
        print(datetime.datetime.now(), 'Running:', ' '.join(argv))
    if (len(argv) == 1):
        if ((sys.version_info < (3,)) and isinstance(argv[0], unicode)):
            argv = shlex.split(argv[0].encode('utf-8'))
        else:
            argv = shlex.split(str(argv[0]))
    stdin = kwargs.pop('stdin', None)
    newenv = os.environ.copy()
    newenv['LANG'] = 'C'
    newenv['LANGUAGE'] = 'C'
    newenv.update(kwargs)
    p = subprocess.Popen(argv, stdin=(subprocess.PIPE if stdin else None), stdout=subprocess.PIPE, stderr=subprocess.STDOUT, env=newenv)
    (out, nothing) = p.communicate(stdin)
    out = out.decode('utf-8', 'replace')
    return (p.returncode, out.strip())

dataset/ETHPy150Open openstack-infra/git-restack/git_restack/cmd.py run_command_status/original