Print stdout only on fail

This commit is contained in:
Michael Chen 2022-11-15 09:43:07 +01:00
parent 465c770247
commit a8a32e91b9
Signed by: cnml
GPG Key ID: 5845BF3F82D5F629

View File

@ -146,8 +146,10 @@ def docker_buildx(repository: str, tags: list[str], build_platforms: list[Docker
*[t for label in labels for t in ("--tag", label)],
"--pull", "--push", directory]
print(" ".join(command))
process = subprocess.run(command, stderr=subprocess.PIPE)
process = subprocess.run(command, stderr=subprocess.PIPE, stdout=subprocess.PIPE)
if process.returncode != 0:
output = process.stdout.decode('utf-8')
print(output)
error = process.stderr.decode('utf-8')
raise Exception(error)