3 import os, sys, pickle, string
5 ########## adds to the kill list of SALOME one more process ##########
6 def addToKillList(command_pid, command):
7 command=(command.split(" "))[0]
11 file = open(os.environ["OMNIORB_CONFIG"], "r")
14 l = string.split(s, ":")
15 if string.split(l[0], " ")[0] == "ORBInitRef" or string.split(l[0], " ")[0] == "InitRef" :
16 my_port = int(l[len(l)-1])
22 #print "myport = ", my_port
24 filedict=os.getenv("HOME")+'/'+os.getenv('USER')+"_"+str(my_port)+'_SALOME_pidict'
26 fpid=open(filedict, 'r')
27 process_ids=pickle.load(fpid)
34 for process_id in process_ids:
36 for pid, cmd in process_id.items():
37 #print "see process %s : %s"% (pid, cmd[0])
38 if pid == command_pid:
44 process_ids.append({command_pid: [command]})
45 fpid=open(filedict,'w')
46 pickle.dump(process_ids, fpid)
49 print "addToKillList: can not add command %s to the kill list"% filedict
53 if __name__ == "__main__":
55 addToKillList(sys.argv[1], sys.argv[2])