From: aguerre Date: Thu, 30 Jan 2014 16:41:40 +0000 (+0000) Subject: Bug fix: passing multiple scripts and args X-Git-Tag: V7_4_0a1~3^2~15 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=cf46af8c99f9a5e0f68b1433259fb553b0405136;p=modules%2Fkernel.git Bug fix: passing multiple scripts and args --- diff --git a/bin/PortManager.py b/bin/PortManager.py index 71143075f..695a32c87 100644 --- a/bin/PortManager.py +++ b/bin/PortManager.py @@ -21,23 +21,14 @@ # # 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 diff --git a/bin/salomeRunner.py b/bin/salomeRunner.py index aa1dee6ca..5be7955a7 100644 --- a/bin/salomeRunner.py +++ b/bin/salomeRunner.py @@ -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 # ###