From 5ccd8b34c445fe94eb444bada98a18d4eb16c90d Mon Sep 17 00:00:00 2001 From: vsr Date: Thu, 29 Nov 2012 07:02:59 +0000 Subject: [PATCH] 1) 0022002: [CEA 723] Error in killSalomeWithPort.py 2) Fix pb in killSalomeWithPort.py - not all servers are killed sometimes --- bin/killSalomeWithPort.py | 13 ++++++++----- bin/salome_utils.py | 7 +++++-- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/bin/killSalomeWithPort.py b/bin/killSalomeWithPort.py index e4ba1d3c3..c6c128b23 100755 --- a/bin/killSalomeWithPort.py +++ b/bin/killSalomeWithPort.py @@ -137,7 +137,7 @@ def appliCleanOmniOrbConfig(port): ########## kills all salome processes with the given port ########## -def shutdownMyPort(port): +def shutdownMyPort(port, cleanup=True): """ Shutdown SALOME session running on the specified port. Parameters: @@ -162,7 +162,7 @@ def shutdownMyPort(port): with_port=port, **kwargs) os.environ['OMNIORB_CONFIG'] = omniorb_config - os.environ['NSPORT'] = port + os.environ['NSPORT'] = str(port) # give the chance to the servers to shutdown properly try: @@ -176,8 +176,11 @@ def shutdownMyPort(port): # give some time to shutdown to complete time.sleep(1) # shutdown omniNames and notifd - lcc.killOmniNames() - time.sleep(1) + if cleanup: + lcc.killOmniNames() + time.sleep(1) + pass + pass except: pass pass @@ -192,7 +195,7 @@ def killMyPort(port): # try to shutdown session nomally import threading, time - threading.Thread(target=shutdownMyPort, args=(port,)).start() + threading.Thread(target=shutdownMyPort, args=(port,False)).start() time.sleep(3) # wait a little, then kill processes (should be done if shutdown procedure hangs up) # new-style dot-prefixed pidict file diff --git a/bin/salome_utils.py b/bin/salome_utils.py index 95e87f42c..295b05d24 100644 --- a/bin/salome_utils.py +++ b/bin/salome_utils.py @@ -194,8 +194,11 @@ def getPortNumber(use_default=True): return int( os.getenv( "NSPORT" ) ) except: pass - port = getPortFromORBcfg() - if port is not None: return port + try: + port = int( getPortFromORBcfg() ) + if port is not None: return port + except: + pass if use_default: return 2809 # '2809' is default port number return None -- 2.39.2