X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=bin%2FaddToKillList.py;h=ca2abd93412ec2f67940379ce0158d5314c564f4;hb=97b8a51943a7412d4a9c8c665214ed67bd72298c;hp=de99c74775a3df05db0876395af34c0801daaa29;hpb=d4617a5edb41e7acd4025a2b56160ae267ede7f6;p=modules%2Fkernel.git diff --git a/bin/addToKillList.py b/bin/addToKillList.py index de99c7477..ca2abd934 100755 --- a/bin/addToKillList.py +++ b/bin/addToKillList.py @@ -1,6 +1,6 @@ #! /usr/bin/env python # -*- coding: iso-8859-1 -*- -# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -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)