Salome HOME
Fix for the bug 0023165: [CEA 1590] Salome 7.6.0 on Windows does not liberate the...
[modules/yacs.git] / src / LifeCycleCORBA / SALOME_LifeCycleCORBA.cxx
index 58d64b4b325cfb5b794fddd6355f5252df9f49da..e6db97ac997c719f5ae49a4a61535f2fdcf92ba8 100644 (file)
@@ -597,23 +597,6 @@ void SALOME_LifeCycleCORBA::shutdownServers()
 void SALOME_LifeCycleCORBA::killOmniNames()
 {
   std::string portNumber (::getenv ("NSPORT") );
-  if ( !portNumber.empty() )
-  {
-#ifdef WIN32
-#else
-    std::string cmd ;
-    cmd = std::string( "ps -eo pid,command | grep -v grep | grep -E \"omniNames.*")
-      + portNumber
-      + std::string("\" | awk '{cmd=sprintf(\"kill -9 %s\",$1); system(cmd)}'" );
-    MESSAGE(cmd);
-    try {
-      system ( cmd.c_str() );
-    }
-    catch ( ... ) {
-    }
-#endif
-  }
-
   std::string python_exe;
 
   python_exe = std::string("python");
@@ -625,7 +608,13 @@ void SALOME_LifeCycleCORBA::killOmniNames()
 
   if ( !portNumber.empty() )
   {
-    std::string cmd = ("from killSalomeWithPort import cleanApplication; ");
+    std::string cmd = ("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("cleanApplication(") + portNumber + "); ";
     //cmd  = python_exe + std::string(" -c \"") + cmd +"\" > /dev/null 2> /dev/null";
     cmd  = python_exe + std::string(" -c \"") + cmd +"\"";