Salome HOME
Fix command executed in a remote shell
authorGilles DAVID <gilles-g.david@edf.fr>
Tue, 14 May 2019 15:21:20 +0000 (17:21 +0200)
committerCédric Aguerre <cedric.aguerre@edf.fr>
Tue, 14 May 2019 16:37:08 +0000 (18:37 +0200)
The salome shell command may load module environments, thus the 'module' command is needed.
This command is only available in a login shell.

bin/runSession.py

index fde468001a926bcf7b8934023b0fe55f67104107..7f4ec5dfe935eb00ff29798c1b99b0397856b973 100644 (file)
@@ -308,10 +308,12 @@ def __runRemoteSession(sa_obj, params):
   tmp_in, tmp_out, tmp_script = __copyFiles(params.user, params.machine, script, sa_obj.args or [], sa_obj.out or [])
 
   # execute command on the remote SALOME application
-  command = "ssh %s@%s %s/salome shell " % (params.user, params.machine, params.directory)
+  command = "%s/salome shell" % (params.directory)
   if params.port:
-    command = command + "-p %s "%params.port
-  command = command + " %s %s args:%s"%(header, tmp_script, ",".join(tmp_in))
+    command += " -p %s "%params.port
+  command += " %s %s args:%s"%(header, tmp_script, ",".join(tmp_in))
+  # salome shell command must run in a login shell because of module function
+  command = "ssh %s@%s -t 'bash -l -c \"%s\"'" % (params.user, params.machine, command)
   print('[  SSH   ] ' + command)
   os.system(command)