]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
Bug fix: passing multiple scripts and args
authoraguerre <aguerre>
Thu, 30 Jan 2014 16:41:40 +0000 (16:41 +0000)
committeraguerre <aguerre>
Thu, 30 Jan 2014 16:41:40 +0000 (16:41 +0000)
bin/PortManager.py
bin/salomeRunner.py

index 71143075f1f895e6557d6fa78e855445ca7a1b7a..695a32c87f4646dd6bb40e63a7a47553c60f7fb6 100644 (file)
 #
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
-import multiprocessing
-import time
-import socket
-
 import os
 import sys
-import threading
-import SocketServer
 
 try:
   import cPickle as pickle
 except:
   import pickle
 
-import struct
-import ctypes
-
 import logging
 def createLogger():
   logger = logging.getLogger(__name__)
@@ -51,12 +42,6 @@ def createLogger():
 #
 logger = createLogger()
 
-
-if sys.platform == 'win32':
-  import multiprocessing.reduction    # make sockets pickable/inheritable
-
-multiprocessing.freeze_support() # Add support for when a program which uses multiprocessing has been frozen to produce a Windows executable.
-
 #------------------------------------
 # A file locker (Linux only)
 import fcntl
index aa1dee6cafbf41b3de61f3c98a7ac38dbec8eb35..5be7955a7230b64e27b926c401eaa68a07854914 100644 (file)
@@ -244,9 +244,21 @@ class SalomeRunner:
     scriptArgs = getScriptsAndArgs(args)
     command = formatScriptsAndArgs(scriptArgs)
     if command:
-      command = command.split(' ')
-      proc = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
-      return proc.communicate()
+      sep = ";"
+      if sys.platform == "win32":
+        sep= "&"
+      command = command.split(sep)
+      outmsg = []
+      errmsg = []
+      for cmd in command:
+        cmd = cmd.strip().split(' ')
+        proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+        (stdoutdata, stderrdata) = proc.communicate()
+        if stdoutdata or stderrdata:
+          outmsg.append(stdoutdata)
+          errmsg.append(stderrdata)
+
+      return ("".join(outmsg), "".join(errmsg))
     else:
       absoluteAppliPath = os.getenv('ABSOLUTE_APPLI_PATH','')
       cmd = ["/bin/bash",  "--rcfile", absoluteAppliPath + "/.bashrc" ]
@@ -342,7 +354,7 @@ class SalomeRunner:
       self._logger = logging.getLogger(__name__)
       #self._logger.setLevel(logging.DEBUG)
       self._logger.setLevel(logging.ERROR)
-    return self._logger;
+    return self._logger
   #
 
 ###