Fixing deadlock

This commit is contained in:
Luis Hebendanz 2023-10-25 19:54:01 +02:00
parent f9b1a8fa89
commit eafc55f2e7

View File

@ -21,7 +21,6 @@ class Command:
stdout: _FILE = None,
stderr: _FILE = None,
workdir: Optional[Path] = None,
check: Optional[bool] = True,
) -> subprocess.Popen[str]:
env = os.environ.copy()
env.update(extra_env)
@ -37,14 +36,6 @@ class Command:
cwd=workdir,
)
self.processes.append(p)
if check:
p.wait()
if p.returncode != 0:
aout = p.stdout.read() if p.stdout else ""
bout = p.stderr.read() if p.stderr else ""
raise subprocess.CalledProcessError(
p.returncode, command, output=aout, stderr=bout
)
return p
def terminate(self) -> None: