From 874d13ff8965a21955a652827cab3488e57f6ad2 Mon Sep 17 00:00:00 2001 From: piegames Date: Fri, 25 Jun 2021 00:03:05 +0200 Subject: [PATCH] Better error message when tasks failed --- sbysrc/sby.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/sbysrc/sby.py b/sbysrc/sby.py index c088aaf..e43458b 100644 --- a/sbysrc/sby.py +++ b/sbysrc/sby.py @@ -423,12 +423,16 @@ def run_job(taskname): return job.retcode +failed = [] retcode = 0 -for t in tasknames: - retcode |= run_job(t) +for task in tasknames: + task_retcode = run_job(task) + retcode |= task_retcode + if task_retcode: + failed.append(task) -if retcode and (len(tasknames) > 1 or tasknames[0] is not None): +if failed and (len(tasknames) > 1 or tasknames[0] is not None): tm = localtime() - print("SBY {:2d}:{:02d}:{:02d} One or more tasks produced a non-zero return code.".format(tm.tm_hour, tm.tm_min, tm.tm_sec)) + print("SBY {:2d}:{:02d}:{:02d} The following tasks failed: {}".format(tm.tm_hour, tm.tm_min, tm.tm_sec, failed)) sys.exit(retcode) -- 2.30.2