From: Serge Rehbinder Date: Wed, 7 Sep 2016 09:36:27 +0000 (+0200) Subject: sat job: catch the error if one of the commands crashes X-Git-Tag: 5.0.0a1~145 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=857a38770d0c6cdf908aa0b94cbfe5fe4a335b2d;p=tools%2Fsat.git sat job: catch the error if one of the commands crashes --- diff --git a/commands/job.py b/commands/job.py index d140531..e78a298 100644 --- a/commands/job.py +++ b/commands/job.py @@ -116,18 +116,26 @@ def run(args, runner, logger): src.printcolors.printcLabel(command) + " ", 3) logger.write("." * (len_max_command - len(command)) + " ", 3) logger.flush() - # Execute the command - code = sat_command(end_cmd, - batch = True, - verbose = 0, - logger_add_link = logger) + + error = "" + try: + # Execute the command + code = sat_command(end_cmd, + batch = True, + verbose = 0, + logger_add_link = logger) + except Exception as e: + code = 1 + error = str(e) + # Print the status of the command if code == 0: nb_pass += 1 logger.write('%s\n' % src.printcolors.printc(src.OK_STATUS), 3) else: res = 1 - logger.write('%s\n' % src.printcolors.printc(src.KO_STATUS), 3) + logger.write('%s %s\n' % (src.printcolors.printc(src.KO_STATUS), + error), 3) # Print the final state if res == 0: