Additional change to previous commit, to fix regression with killing SALOME session.
except:
print "Cannot find or open SALOME PIDs file for port", port
pass
+ os.remove(filedict)
+ pass
#
def __guessPiDictFilename(port):
pass
appliCleanOmniOrbConfig(port)
+ pass
def killMyPortSpy(pid, port):
dt = 1.0
"""
Kill process by pid.
"""
+ if not pid: return
import os,sys,signal
if verbose(): print "######## killpid pid = ", pid
if sys.platform == "win32":
# 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
"""
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
+# --
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() );
// 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() );