Salome HOME
sat #32302 pip option --build obsolète : integration du patch fourni par Nabil
[tools/sat.git] / commands / shell.py
index b246072512133ff5bbe80dd1e46e5282cf1baf79..c2139755c3b373d66b2a1ab64b1a4be4cc03dee2 100644 (file)
@@ -31,8 +31,11 @@ def description():
     :return: The text to display for the shell command description.
     :rtype: str
     '''
-    return _("Executes the shell command passed as argument.\n\nexample:"
-             "\nsat shell --command \"ls \\-l /tmp\"")
+    return _("""\
+The shell command executes the shell commands passed as argument.
+
+example:
+>> sat shell --command "ls -l /tmp" """)
   
 def run(args, runner, logger):
     '''method that is called when salomeTools is called with shell parameter.
@@ -46,14 +49,24 @@ def run(args, runner, logger):
         message = _("The option --command is required\n")      
         logger.write(src.printcolors.printcError(message))
         return 1
-
+    
+    # Print the input command
+    msg = _("Command to execute:\n%s\nExecution ... " % options.command)
+    logger.write(msg, 3)
+    
+    # Call the input command
     res = subprocess.call(options.command,
                           shell=True,
                           stdout=logger.logTxtFile,
                           stderr=subprocess.STDOUT)
-    
     # Format the result to be 0 (success) or 1 (fail)
     if res != 0:
         res = 1
+        logger.write(src.printcolors.printc("KO"), 3)
+    else:
+        logger.write(src.printcolors.printc("OK"), 3)
+    
+    logger.write("\n",3)
     
     return res
\ No newline at end of file