From 132db7b3e35e46578763915130f312e07cd5d4e8 Mon Sep 17 00:00:00 2001 From: dmv Date: Thu, 20 Dec 2007 15:13:29 +0000 Subject: [PATCH] NPAL 18309 --- src/Session/SALOME_Session_Server.cxx | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/Session/SALOME_Session_Server.cxx b/src/Session/SALOME_Session_Server.cxx index af7004f6c..c94505e0e 100755 --- a/src/Session/SALOME_Session_Server.cxx +++ b/src/Session/SALOME_Session_Server.cxx @@ -39,6 +39,8 @@ #include #ifndef WNT #include +#include +#include #endif #include @@ -372,6 +374,28 @@ void shutdownServers( SALOME_NamingService* theNS ) Registry::Components_var registry = Registry::Components::_narrow(objR); if ( !CORBA::is_nil(registry) && ( session->getPID() != registry->getPID() ) ) registry->end(); + + // 9) Kill OmniNames + QString fileName( ::getenv ("OMNIORB_CONFIG") ); + QString portNumber; + if ( !fileName.isEmpty() ) { + QFile aFile( fileName ); + if ( aFile.open(IO_ReadOnly) ) { + QRegExp re("InitRef = .*:([0-9]+)$"); + QTextStream stream ( &aFile ); + while ( !stream.atEnd() ) { + QString textLine = stream.readLine(); + if ( re.search( textLine ) > -1 ) + portNumber = re.cap(1); + } + aFile.close(); + } + } + if ( !portNumber.isEmpty() ) { + QString cmd = QString( "ps -eo pid,command | grep -v grep | grep -E \"omniNames.*%1\" | awk '{cmd=sprintf(\"kill -9 %s\",$1); system(cmd)}'" ).arg( portNumber ); + system ( cmd.latin1() ); + } + } } -- 2.39.2