: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.
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