From: Serge Rehbinder Date: Thu, 27 Oct 2016 12:22:18 +0000 (+0200) Subject: sat job : get full stack ig one command fails X-Git-Tag: 5.0.0a1~61 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=947059882d1341cfbd137690643e721525650ff8;p=tools%2Fsat.git sat job : get full stack ig one command fails --- diff --git a/commands/job.py b/commands/job.py index 0b7ed6d..908aa9c 100644 --- a/commands/job.py +++ b/commands/job.py @@ -17,6 +17,9 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA import os +import sys +import traceback +import tempfile import src @@ -133,7 +136,15 @@ def run(args, runner, logger): logger_add_link = logger) except Exception as e: code = 1 + # Get error error = str(e) + # get stack + __, __, exc_traceback = sys.exc_info() + fp = tempfile.TemporaryFile() + traceback.print_tb(exc_traceback, limit=1, file=fp) + fp.seek(0) + stack = fp.read() + # Print the status of the command if code == 0: @@ -143,6 +154,7 @@ def run(args, runner, logger): res = 1 logger.write('%s %s\n' % (src.printcolors.printc(src.KO_STATUS), error), 3) + logger.write('stack: %s\n' % stack, 3) # Print the final state if res == 0: