show more context for zenith cli run errors

This commit is contained in:
Dmitry Rodionov
2021-09-14 18:36:19 +03:00
committed by Dmitry
parent 6a2e4bfdd9
commit 01ef2baef0

View File

@@ -185,12 +185,16 @@ class ZenithCli:
universal_newlines=True,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
except subprocess.CalledProcessError as err:
print(f"Run failed: {err}")
print(f" stdout: {err.stdout}")
print(f" stderr: {err.stderr}")
except subprocess.CalledProcessError as exc:
# this way command output will be in recorded and shown in CI in failure message
msg = f"""\
Run failed: {exc}
stdout: {exc.stdout}
stderr: {exc.stderr}
"""
print(msg)
raise err
raise Exception(msg) from exc
return res