Merge pull request #1489 from ogayot/inc-proc-output-in-except

utils: inc. captured stdout / stderr when forging CalledProcessError
This commit is contained in:
Olivier Gayot 2022-11-22 09:36:48 +01:00 committed by GitHub
commit fd3a856bc4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -102,7 +102,8 @@ async def arun_command(cmd: Sequence[str], *,
# .communicate() forces returncode to be set to a value
assert(proc.returncode is not None)
if check and proc.returncode != 0:
raise subprocess.CalledProcessError(proc.returncode, cmd)
raise subprocess.CalledProcessError(proc.returncode, cmd,
stdout, stderr)
else:
return subprocess.CompletedProcess(
cmd, proc.returncode, stdout, stderr)