(options, args) = parser.parse_args(args)
except Exception, e:
print e
- return
+ return {}, []
return options, args
#
options, args = __parse_args(args)
host, port, filename = __get_running_session(options.port)
if not port:
- return 0
+ return 1
cmd = [
"os.environ['OMNIORB_CONFIG'] = '%s'"%filename,
absoluteAppliPath = os.getenv('ABSOLUTE_APPLI_PATH','')
env_copy = os.environ.copy()
proc = subprocess.Popen(['python', os.path.join(absoluteAppliPath,"bin","salome","runConsole.py"), pickle.dumps(cmd)], shell=False, close_fds=True, env=env_copy)
- return proc.communicate()
+ proc.communicate()
+ return proc.returncode
#
if __name__ == "__main__":
# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2017 CEA/DEN, EDF R&D, OPEN CASCADE
#
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
(options, args) = parser.parse_args(short_args)
except Exception, e:
print e
- return
+ return None, []
port = options.port
host = options.host
sys.stderr.write("".join(errmsg))
sys.exit(1)
- return ("".join(outmsg), "".join(errmsg))
+ return 0
else:
absoluteAppliPath = os.getenv('ABSOLUTE_APPLI_PATH','')
if sys.platform == "win32":
else:
cmd = ["/bin/bash", "--rcfile", absoluteAppliPath + "/.bashrc" ]
proc = subprocess.Popen(cmd, shell=False, close_fds=True)
- return proc.communicate()
+ proc.communicate()
+ return proc.returncode
#
def __copyFiles(user, machine, script, infiles, outfiles):
def __runRemoteSession(sa_obj, params):
if not params.user:
print "ERROR: The user login on remote machine MUST be given."
- return
+ return 1
if not params.directory:
print "ERROR: The remote directory MUST be given."
- return
+ return 1
# sa_obj.script may be 'python script.py' --> only process .py file
header = " ".join(sa_obj.script.split()[:-1])
os.system(command)
os.remove(tmp_script)
+ return 0
#
def runSession(params, args):
return __runLocalSession(command)
elif params.mode == "remote":
+ any_error = 0
for sa_obj in scriptArgs:
- __runRemoteSession(sa_obj, params)
+ ok = __runRemoteSession(sa_obj, params)
+ if not ok:
+ any_error = 1
+ return any_error
#
import runSalome
runSalome.runSalome()
+ return 0
#
def _setContext(self, args=None):
print "*** SALOME context has already been set."
print "*** Enter 'exit' (only once!) to leave SALOME context."
print "***"
- return
+ return 0
os.environ["SALOME_CONTEXT_SET"] = "yes"
print "***"
cmd = ["/bin/bash"]
proc = subprocess.Popen(cmd, shell=False, close_fds=True)
- return proc.communicate()
+ proc.communicate()
+ return proc.returncode()
#
def _runSession(self, args=None):
ports = args
if not ports:
print "Port number(s) not provided to command: salome kill <port(s)>"
- return
+ return 1
from multiprocessing import Process
from killSalomeWithPort import killMyPort
p = Process(target = killMyPort, args=(port,))
p.start()
p.join()
- pass
+ return 0
#
def _killAll(self, unused=None):
from killSalome import killAllPorts
killAllPorts()
pass
+ return 0
#
def _runTests(self, args=None):
if "-h" in args or "--help" in args:
print usage + epilog
- return
+ return 0
if "-p" in args or "--ports" in args:
import PortManager
if "-v" in args or "--version" in args:
print "Running with python", platform.python_version()
- self._runAppli(["--version"])
+ return self._runAppli(["--version"])
+
+ return 0
#
def _showDoc(self, args=None):
modules = args
if not modules:
print "Module(s) not provided to command: salome doc <module(s)>"
- return
+ return 1
appliPath = os.getenv("ABSOLUTE_APPLI_PATH")
if not appliPath: