Salome HOME
Correct the message when incompatible options are called
[tools/sat.git] / commands / job.py
index c15afdb42988ef8288d48b31f773e45d742136e3..f27f7e733363ba4b6dde398d9517f092f75fa878 100644 (file)
@@ -17,9 +17,6 @@
 #  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 
 import os
-import sys
-import traceback
-import tempfile
 
 import src
 import salomeTools
@@ -118,7 +115,8 @@ def run(args, runner, logger):
         if cmd_exe == "sat":
             # use the salomeTools parser to get the options of the command
             sat_parser = salomeTools.parser
-            (options, argus) = sat_parser.parse_args(command.split(' ')[1:])
+            input_parser = src.remove_item_from_list(command.split(' ')[1:], "")
+            (options, argus) = sat_parser.parse_args(input_parser)
             # Verify if there is a changed option
             for attr in dir(options):
                 if attr.startswith("__"):
@@ -135,8 +133,9 @@ def run(args, runner, logger):
         if not(specific_option):
             options = None
 
-        # Get dynamically the command function to call 
+        # Get dynamically the command function to call
         sat_command = runner.__getattr__(sat_command_name)
+
         logger.write("Executing " + 
                      src.printcolors.printcLabel(command) + " ", 3)
         logger.write("." * (len_max_command - len(command)) + " ", 3)
@@ -144,35 +143,20 @@ def run(args, runner, logger):
         
         error = ""
         stack = ""
-        try:
-            # Execute the command
-            code = sat_command(end_cmd,
-                               options = options,
-                               batch = True,
-                               verbose = 0,
-                               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, file=fp)
-            fp.seek(0)
-            stack = fp.read()
-            logger.add_link(_("Dead Link"),
-                            sat_command_name,
-                            code,
-                            "ERROR: %s TRACEBACK: %s" % (error,
-                                                    stack.replace('"',"'")))
+        # Execute the command
+        code = sat_command(end_cmd,
+                           options = options,
+                           batch = True,
+                           verbose = 0,
+                           logger_add_link = logger)
             
         # 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
+            if sat_command_name != "test":
+                res = 1
             logger.write('%s %s\n' % (src.printcolors.printc(src.KO_STATUS),
                                       error), 3)
             if len(stack) > 0: