File size: 378 Bytes
ff88fc5 | 1 2 3 4 5 6 7 8 9 10 11 12 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
from subprocess import PIPE, Popen
from typing import Any
def run_with_error(cmd: Any) -> str:
with Popen(cmd, stdout=PIPE, stderr=PIPE) as p:
_stdout, stderr = p.communicate()
err = stderr.decode("utf-8").rstrip().replace("\r\n", "\n")
assert p.returncode == 1
return err
|