From: Cédric Aguerre Date: Thu, 6 Apr 2017 07:54:30 +0000 (+0200) Subject: catch exception on salome_instance, and prefer sys.exit to exit X-Git-Tag: V8_3_0rc1~1^2~2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=82f925a427b800f0851cfefac8f2dfc257358d03;p=modules%2Fkernel.git catch exception on salome_instance, and prefer sys.exit to exit --- diff --git a/bin/appliskel/salome_tester/salome_test_driver.py b/bin/appliskel/salome_tester/salome_test_driver.py index 60b8fd9a2..7b119d176 100644 --- a/bin/appliskel/salome_tester/salome_test_driver.py +++ b/bin/appliskel/salome_tester/salome_test_driver.py @@ -1,4 +1,4 @@ -# Copyright (C) 2015-2016 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2015-2017 CEA/DEN, EDF R&D, OPEN CASCADE # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -54,7 +54,7 @@ if __name__ == "__main__": # first argument if not args: print "Invalid arguments for salome_test_driver.py. No command defined." - exit(1) + sys.exit(1) _, ext = os.path.splitext(args[0]) if ext == ".py": test_and_args = [sys.executable] + args @@ -89,10 +89,12 @@ if __name__ == "__main__": import traceback traceback.print_exc() pass - - salome_instance.stop() + try: + salome_instance.stop() + except: + pass if sys.platform == 'win32': timer.cancel() print "Exit test with status code:", res - exit(res) + sys.exit(res) # diff --git a/bin/appliskel/salome_tester/salome_test_driver_gui.py b/bin/appliskel/salome_tester/salome_test_driver_gui.py index 284f9e624..7ef53d33f 100644 --- a/bin/appliskel/salome_tester/salome_test_driver_gui.py +++ b/bin/appliskel/salome_tester/salome_test_driver_gui.py @@ -1,4 +1,4 @@ -# Copyright (C) 2015-2016 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2015-2017 CEA/DEN, EDF R&D, OPEN CASCADE # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -42,7 +42,7 @@ if __name__ == "__main__": # first argument if not args: print "Invalid arguments for salome_test_driver_gui.py. No command defined." - exit(1) + sys.exit(1) _, ext = os.path.splitext(args[0]) test_and_args = args @@ -71,10 +71,12 @@ if __name__ == "__main__": import traceback traceback.print_exc() pass - - salome_instance.stop() + try: + salome_instance.stop() + except: + pass if sys.platform == 'win32': timer.cancel() # print "Exit test with status code:", res -# exit(res) +# sys.exit(res) # diff --git a/bin/killSalomeWithPort.py b/bin/killSalomeWithPort.py index 9670329bf..fa8953b7c 100755 --- a/bin/killSalomeWithPort.py +++ b/bin/killSalomeWithPort.py @@ -1,6 +1,6 @@ #! /usr/bin/env python # -*- 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 @@ -214,7 +214,7 @@ def shutdownMyPort(port, cleanup=True): pass except: pass - exit(0) # see (1) + sys.exit(0) # see (1) pass # (1) If --shutdown-servers option is set to 1, session close procedure is # called twice: first explicitely by salome command, second by automatic