Exemple #1
0
def run(command: List[str], *, working_directory: Optional[Path]) -> None:
    UI.log("Running {}".format(" ".join(map(shlex.quote, command))))
    p = subprocess.Popen(
        command,
        stdout=subprocess.PIPE,
        stderr=subprocess.STDOUT,
        encoding="utf-8",
        cwd=working_directory,
    )
    while True:
        retcode = p.poll()
        line = p.stdout.readline().rstrip()

        if line:
            with UI.indent():
                UI.log(line)

        if retcode is not None:
            break
Exemple #2
0
def run(command: List[str], *, working_directory: Optional[Path]) -> None:
    cmd = " ".join(map(shlex.quote, command))
    UI.log(f"Running {cmd}")
    p = subprocess.Popen(
        command,
        stdout=subprocess.PIPE,
        stderr=subprocess.STDOUT,
        encoding="utf-8",
        cwd=working_directory,
    )
    while True:
        retcode = p.poll()
        line = p.stdout.readline().rstrip()

        if line:
            with UI.indent():
                UI.log(line)

        if retcode is not None:
            break
    if retcode:
        raise VendoringError(
            f"Command exited with non-zero exit code: {retcode}")