From: Cédric Aguerre Date: Thu, 6 Apr 2017 12:18:02 +0000 (+0200) Subject: Do not force exit calls, use return X-Git-Tag: V8_3_0rc1~1^2~1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=c13208292e0d33789a6d3e35d5daf594064c6e41;p=modules%2Fkernel.git Do not force exit calls, use return --- diff --git a/bin/runConsole.py b/bin/runConsole.py index bb2192c86..51f9fe2ba 100644 --- a/bin/runConsole.py +++ b/bin/runConsole.py @@ -1,5 +1,5 @@ # -*- 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 @@ -198,7 +198,7 @@ def connect(args=None, env=None): options, args = __parse_args(args) host, port, filename = __get_running_session(options.port) if not port: - sys.exit(0) + return 0 cmd = [ "os.environ['OMNIORB_CONFIG'] = '%s'"%filename, diff --git a/bin/salomeContext.py b/bin/salomeContext.py index 2b7ffad5d..2e63384f2 100644 --- a/bin/salomeContext.py +++ b/bin/salomeContext.py @@ -254,7 +254,7 @@ class SalomeContext: if command is None: if args and args[0] in ["-h","--help","help"]: usage() - sys.exit(0) + return 0 # try to default to "start" command command = "_runAppli" @@ -264,15 +264,15 @@ class SalomeContext: except SystemExit, returncode: if returncode != 0: self.getLogger().error("SystemExit %s in method %s.", returncode, command) - sys.exit(returncode) + return returncode except StandardError: self.getLogger().error("Unexpected error:") import traceback traceback.print_exc() - sys.exit(1) + return 1 except SalomeContextException, e: self.getLogger().error(e) - sys.exit(1) + return 1 # def __setContextFromConfigFile(self, filename, reserved=None): @@ -283,7 +283,7 @@ class SalomeContext: except SalomeContextException, e: msg = "%s"%e self.getLogger().error(msg) - sys.exit(1) + return 1 # unset variables for var in unsetVars: @@ -555,7 +555,6 @@ Available options are: print "" print " SALOME is working for you; what else?" print "" - sys.exit(0) # def _getCar(self, unused=None): @@ -589,7 +588,6 @@ Available options are: print "" print " Drive your simulation properly with SALOME!" print "" - sys.exit(0) # # Add the following two methods since logger is not pickable @@ -618,11 +616,7 @@ if __name__ == "__main__": context = pickle.loads(sys.argv[1]) args = pickle.loads(sys.argv[2]) - (out, err) = context._startSalome(args) - if out: - sys.stdout.write(out) - if err: - sys.stderr.write(err) + context._startSalome(args) else: usage() #