X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=bin%2FrunSession.py;h=fde468001a926bcf7b8934023b0fe55f67104107;hb=f8d59ad69ef3e2b294ae387d467663339adf3189;hp=e17a7bd9ca16b1d28fdb87cfbce18a3616923da4;hpb=8723fcf67b7efe234c1c63bb7139ee7a247ed421;p=modules%2Fkernel.git diff --git a/bin/runSession.py b/bin/runSession.py index e17a7bd9c..fde468001 100644 --- a/bin/runSession.py +++ b/bin/runSession.py @@ -1,5 +1,5 @@ # -*- coding: iso-8859-1 -*- -# Copyright (C) 2007-2017 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2019 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 @@ -118,6 +118,10 @@ User "myself" connects to remotemachine to run the script concatenate.py in help="[Remote mode] The user on the computer to connect to." ) + parser.add_option('-l', '--launcher', dest="launcher", default=None, + help="[Remote mode] The machine and the port to connect to." + ) + short_args, extra_args = getShortAndExtraArgs(args) try: (options, args) = parser.parse_args(short_args) @@ -127,6 +131,12 @@ User "myself" connects to remotemachine to run the script concatenate.py in port = options.port host = options.host + launcher = options.launcher + if launcher is not None: + pos = launcher.find(":") + if pos != -1: + host = launcher[0:pos] + port = launcher[pos+1:] # :GLITCH: this code defines specific environment variables (OMNIORB_CONFIG, NSPORT, # NSHOST) which are later used by other modules. Working, but not really "safe"... @@ -162,7 +172,7 @@ User "myself" connects to remotemachine to run the script concatenate.py in # determine running mode, that is either 'local' or 'remote' here = getShortHostName() mode = "local" - if host != here and host != "localhost" and host != "no_host": + if host != here and host != "localhost" and host != "no_host" and launcher is None: mode="remote" pass params = SessionParameters(mode, port, host, options.user, options.directory) @@ -193,6 +203,7 @@ def __runLocalSession(command): for cmd in command: single_cmd = cmd.strip().split(' ') any_error = False + error_code = 1 try: proc = subprocess.Popen(single_cmd) (stdoutdata, stderrdata) = proc.communicate() # Wait for process to terminate @@ -203,6 +214,7 @@ def __runLocalSession(command): if proc.returncode != 0: any_error = True + error_code = proc.returncode except: any_error = True pass @@ -213,7 +225,7 @@ def __runLocalSession(command): sys.stdout.write("".join(outmsg)) if errmsg: sys.stderr.write("".join(errmsg)) - sys.exit(1) + sys.exit(error_code) return 0 else: