Salome HOME
Code cleanup following previous fix
[modules/kernel.git] / bin / addToKillList.py
index 91068ee45ec2482cfbe2a7c990b5410182134a6f..24ca6783ff209d14f22a0814c868134668eddf6e 100755 (executable)
@@ -8,7 +8,7 @@
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public
 # License as published by the Free Software Foundation; either
-# version 2.1 of the License.
+# version 2.1 of the License, or (at your option) any later version.
 #
 # This library is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -22,7 +22,7 @@
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 
-import os, sys, pickle, string, signal
+import os, sys, pickle, signal
 from launchConfigureParser import verbose
 
 ########## adds to the kill list of SALOME one more process ##########
@@ -49,11 +49,7 @@ def addToKillList(command_pid, command, port=None):
     # retrieve current processes dictionary
     from killSalomeWithPort import getPiDict
     if port is None: port=findFileDict()
-    try:
-        import PortManager
-        filedict = getPiDict(port, hidden=True, with2809pid=True)
-    except:
-        filedict=getPiDict(port)
+    filedict = getPiDict(port)
 
     try:
         with open(filedict, 'r') as fpid:
@@ -64,13 +60,14 @@ def addToKillList(command_pid, command, port=None):
     # check if PID is already in dictionary
     already_in=False
     for process_id in process_ids:
-        for pid, cmd in process_id.items():
+        for pid in process_id.keys():
             if int(pid) == int(command_pid):
                 already_in=True
                 break
             pass
         if already_in: break
         pass
+
     # add process to the dictionary
     if not already_in:
         import types
@@ -98,10 +95,12 @@ def killList(port=None):
     # retrieve processes dictionary
     from killSalomeWithPort import getPiDict
     if port is None: port=findFileDict()
+
     # new-style dot-prefixed pidict file
-    filedict=getPiDict(port, hidden=True)
+    filedict=getPiDict(port)
     # provide compatibility with old-style pidict file (not dot-prefixed)
     if not os.path.exists(filedict): filedict = getPiDict(port, hidden=False)
+
     try:
         with open(filedict, 'r') as fpid:
             process_ids=pickle.load(fpid)