]> SALOME platform Git repositories - modules/yacs.git/commitdiff
Salome HOME
Fix for the bug 0023165: [CEA 1590] Salome 7.6.0 on Windows does not liberate the...
authorvsr <vsr@opencascade.com>
Fri, 20 Nov 2015 10:11:38 +0000 (13:11 +0300)
committervsr <vsr@opencascade.com>
Fri, 20 Nov 2015 10:11:38 +0000 (13:11 +0300)
Additional change to previous commit, to fix regression with killing SALOME session.

bin/killSalomeWithPort.py
bin/salome_utils.py
src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx

index 67d205c4ace71333e709a045167a7e0767b321f1..a1057d8ad9a29cc17abbe0951239bb4095928454 100755 (executable)
@@ -245,6 +245,8 @@ def __killMyPort(port, filedict):
     except:
         print "Cannot find or open SALOME PIDs file for port", port
         pass
+    os.remove(filedict)
+    pass
 #
 
 def __guessPiDictFilename(port):
@@ -347,6 +349,7 @@ def cleanApplication(port):
       pass
 
     appliCleanOmniOrbConfig(port)
+    pass
 
 def killMyPortSpy(pid, port):
     dt = 1.0
index b3efa87570f8312dc234d3df1bf9f9204caea7ae..2dbe6b3645fd48a286a7e16670bf6945fe910d81 100644 (file)
@@ -489,6 +489,7 @@ def killpid(pid):
     """
     Kill process by pid.
     """
+    if not pid: return
     import os,sys,signal
     if verbose(): print "######## killpid pid = ", pid
     if sys.platform == "win32":
@@ -527,7 +528,7 @@ def getOmniNamesPid(port):
         # find Pid of omniNames
         pid = re.findall(r'Caption=.*omniNames.*\n?CommandLine=.*omniNames.*\D%s\D.*\n?ProcessId=(\d*)'%(port),allProc)[0]
     else:        
-        cmd = r"ps -eo pid,command | grep -v grep | grep -E \"omniNames.*%s\""%(port)
+        cmd = "ps -eo pid,command | grep -v grep | grep -E \"omniNames.*%s\" | awk '{print $1}'"%(port)
         proc = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE)
         pid = proc.communicate()[0]
         pass
@@ -539,6 +540,10 @@ def killOmniNames(port):
     """
     Kill OmniNames process by port number.
     """
-    pid = getOmniNamesPid(port)
-    killpid(pid)
-# --
\ No newline at end of file
+    try:
+        pid = getOmniNamesPid(port)
+        if pid: killpid(pid)
+    except:
+        pass
+    pass
+# --
index e6db97ac997c719f5ae49a4a61535f2fdcf92ba8..966ab07d6d212cef0800d68bc50794c38724dd39 100644 (file)
@@ -608,15 +608,16 @@ void SALOME_LifeCycleCORBA::killOmniNames()
 
   if ( !portNumber.empty() )
   {
-    std::string cmd = ("from salome_utils import killOmniNames; ");
+    std::string cmd;
+
+    cmd  = std::string("from salome_utils import killOmniNames; ");
     cmd += std::string("killOmniNames(") + portNumber + "); ";
     cmd  = python_exe + std::string(" -c \"") + cmd +"\"";
     MESSAGE(cmd);
     system( cmd.c_str() );
 
-    cmd ("from killSalomeWithPort import cleanApplication; ");
+    cmd  = std::string("from killSalomeWithPort import cleanApplication; ");
     cmd += std::string("cleanApplication(") + portNumber + "); ";
-    //cmd  = python_exe + std::string(" -c \"") + cmd +"\" > /dev/null 2> /dev/null";
     cmd  = python_exe + std::string(" -c \"") + cmd +"\"";
     MESSAGE(cmd);
     system( cmd.c_str() );
@@ -626,9 +627,10 @@ void SALOME_LifeCycleCORBA::killOmniNames()
   // shutdown portmanager
   if ( !portNumber.empty() )
   {
-    std::string cmd = ("from PortManager import releasePort; ");
+    std::string cmd;
+
+    cmd  = std::string("from PortManager import releasePort; ");
     cmd += std::string("releasePort(") + portNumber + "); ";
-    //cmd  = python_exe + std::string(" -c \"") + cmd +"\" > /dev/null 2> /dev/null";
     cmd  = python_exe + std::string(" -c \"") + cmd +"\"";
     MESSAGE(cmd);
     system( cmd.c_str() );