]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
MPV: fix for bug IPAL9221
authormpv <mpv@opencascade.com>
Fri, 24 Jun 2005 12:38:19 +0000 (12:38 +0000)
committermpv <mpv@opencascade.com>
Fri, 24 Jun 2005 12:38:19 +0000 (12:38 +0000)
add script for addind processes to the kill list
this script is called by SALOME_Container to register new run-time launched process

Makefile.in
bin/addToKillList.py [new file with mode: 0755]

index 7aa9cdf49b1a177bf3bfe7a1a4bc70ae44b142a9..90665ff5d2033c19efc821c08997c2ae73d99030 100644 (file)
@@ -39,7 +39,8 @@ launchConfigureParser.py \
 salome.launch \
 envSalome.py \
 salomeConsole.py \
-showNS.py
+showNS.py \
+addToKillList.py
 
 # copy header files in common directory
 OWN_CONFIG_H=@OWN_CONFIG_H@
diff --git a/bin/addToKillList.py b/bin/addToKillList.py
new file mode 100755 (executable)
index 0000000..7dad20e
--- /dev/null
@@ -0,0 +1,55 @@
+#!/usr/bin/env python
+
+import os, sys, pickle, string
+
+########## adds to the kill list of SALOME one more process ##########
+def addToKillList(command_pid, command):
+    command=(command.split(" "))[0]
+
+    my_port = 2809
+    try:
+      file = open(os.environ["OMNIORB_CONFIG"], "r")
+      s = file.read()
+      while len(s):
+        l = string.split(s, ":")
+        if string.split(l[0], " ")[0] == "ORBInitRef" or string.split(l[0], " ")[0] == "InitRef" :
+          my_port = int(l[len(l)-1])
+          pass
+        s = file.read()
+        pass
+    except:
+       pass
+    #print "myport = ", my_port
+
+    filedict=os.getenv("HOME")+'/'+os.getenv('USER')+"_"+str(my_port)+'_SALOME_pidict'
+    try:
+        fpid=open(filedict, 'r')
+        process_ids=pickle.load(fpid)
+        fpid.close()
+    except:
+        process_ids=[{}]
+        pass
+        
+    already_in=0
+    for process_id in process_ids:
+        print process_id
+        for pid, cmd in process_id.items():
+            #print "see process %s : %s"% (pid, cmd[0])
+           if pid == command_pid:
+               already_in=1
+        pass
+
+    if already_in == 0:
+        try:
+           process_ids.append({command_pid: [command]})
+           fpid=open(filedict,'w')
+            pickle.dump(process_ids, fpid)
+           fpid.close()
+        except:
+           print "addToKillList: can not add command %s to the kill list"% filedict
+           pass
+       pass
+
+if __name__ == "__main__":
+    print sys.argv
+    addToKillList(sys.argv[1], sys.argv[2])