From 0a5db8a9cf364ca82d300ce4d8d9e87836bbe651 Mon Sep 17 00:00:00 2001 From: Serge Rehbinder Date: Tue, 15 Nov 2016 15:21:49 +0100 Subject: [PATCH] Jobs returns 1 if one or more jobs failed --- commands/jobs.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/commands/jobs.py b/commands/jobs.py index 288da40..258f530 100644 --- a/commands/jobs.py +++ b/commands/jobs.py @@ -1667,7 +1667,9 @@ def run(args, runner, logger): logger.write("\n\n%s\n\n" % (src.printcolors.printcWarning(_("Forced interruption"))), 1) finally: + res = 0 if interruped: + res = 1 msg = _("Killing the running jobs and trying" " to get the corresponding logs\n") logger.write(src.printcolors.printcWarning(msg)) @@ -1675,11 +1677,14 @@ def run(args, runner, logger): # find the potential not finished jobs and kill them for jb in today_jobs.ljobs: if not jb.has_finished(): + res = 1 try: jb.kill_remote_process() except Exception as e: msg = _("Failed to kill job %s: %s\n" % (jb.name, e)) logger.write(src.printcolors.printcWarning(msg)) + if jb.res_job != "0": + res = 1 if interruped: if today_jobs.gui: today_jobs.gui.last_update(_("Forced interruption")) @@ -1688,3 +1693,4 @@ def run(args, runner, logger): today_jobs.gui.last_update() # Output the results today_jobs.write_all_results() + return res \ No newline at end of file -- 2.39.2