

def execute(cmdline, return_errcode=False, show_output=True):
    if isinstance(cmdline, list):
        print(('>>> %s' % subprocess.list2cmdline(cmdline)))
    else:
        print(('>>> %s' % cmdline))
    p = subprocess.Popen(cmdline, shell=False, stdout=subprocess.PIPE)
    s = ''
    for data in p.stdout.readlines():
        s += data
        if show_output:
            sys.stdout.write(data)
    rc = p.wait()
    if return_errcode:
        return (s, rc)
    if (rc != 0):
        die('!!! Error invoking command.')
    return s

dataset/ETHPy150Open reviewboard/reviewboard/contrib/internal/test-upgrade.py execute/original