Salome HOME
1) 0022002: [CEA 723] Error in killSalomeWithPort.py
authorvsr <vsr@opencascade.com>
Thu, 29 Nov 2012 07:02:59 +0000 (07:02 +0000)
committervsr <vsr@opencascade.com>
Thu, 29 Nov 2012 07:02:59 +0000 (07:02 +0000)
2) Fix pb in killSalomeWithPort.py - not all servers are killed sometimes

bin/killSalomeWithPort.py
bin/salome_utils.py

index e4ba1d3c35fd3644dc5f4f2aba3d3643e7f003ac..c6c128b234aca035c1ac4104a1e6a2441fca083f 100755 (executable)
@@ -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
index 95e87f42cfdbc871f708f0014f1320c4abf10384..295b05d24db391172e8c3586a57d3b8de9a6a9e5 100644 (file)
@@ -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