osmith has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ci/+/29429 )
Change subject: obs: don't print verbose output twice on error ......................................................................
obs: don't print verbose output twice on error
When running in verbose mode, it's enough that the output is displayed while the command is running. Don't print it again on error.
Change-Id: I4fcf2421a6f82bd94ba098b39f58e5d3f18aa8fd --- M scripts/obs/lib/__init__.py 1 file changed, 6 insertions(+), 1 deletion(-)
Approvals: pespin: Looks good to me, but someone else must approve osmith: Looks good to me, approved msuraev: Looks good to me, but someone else must approve Jenkins Builder: Verified
diff --git a/scripts/obs/lib/__init__.py b/scripts/obs/lib/__init__.py index d66aa3b..58fe0e4 100644 --- a/scripts/obs/lib/__init__.py +++ b/scripts/obs/lib/__init__.py @@ -88,12 +88,17 @@
def exit_error_cmd(completed, error_msg): """ :param completed: return from run_cmd() below """ + global cmds_verbose + print() print(f"ERROR: {error_msg}") print() print(f"*** command ***\n{completed.args}\n") print(f"*** returncode ***\n{completed.returncode}\n") - print(f"*** output ***\n{completed.output}") + + if not cmds_verbose: + print(f"*** output ***\n{completed.output}") + print("*** python trace ***") raise RuntimeError("shell command related error, find details right above" " this python trace")