From: Nicolas Geimer Date: Wed, 19 Apr 2017 12:52:07 +0000 (+0200) Subject: Fix salome killall X-Git-Tag: V9_0_0~25^2~9 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=9e94afb7447efd6ac8e1ed3ee82cfa2a79d9749d;p=modules%2Fkernel.git Fix salome killall --- diff --git a/bin/PortManager.py b/bin/PortManager.py index f838a2ddf..0c0c6ec7b 100644 --- a/bin/PortManager.py +++ b/bin/PortManager.py @@ -137,7 +137,7 @@ def getPort(preferedPort=None): config_file, lock_file = _getConfigurationFilename() oldmask = os.umask(0) - with open(lock_file, 'w') as lock: + with open(lock_file, 'wb') as lock: # acquire lock __acquire_lock(lock) @@ -196,7 +196,7 @@ def releasePort(port): config_file, lock_file = _getConfigurationFilename() oldmask = os.umask(0) - with open(lock_file, 'w') as lock: + with open(lock_file, 'wb') as lock: # acquire lock __acquire_lock(lock) @@ -239,7 +239,7 @@ def releasePort(port): def getBusyPorts(): config_file, lock_file = _getConfigurationFilename() oldmask = os.umask(0) - with open(lock_file, 'w') as lock: + with open(lock_file, 'wb') as lock: # acquire lock __acquire_lock(lock) diff --git a/bin/addToKillList.py b/bin/addToKillList.py index 06a32f46b..9be099991 100755 --- a/bin/addToKillList.py +++ b/bin/addToKillList.py @@ -50,9 +50,10 @@ def addToKillList(command_pid, command, port=None): from killSalomeWithPort import getPiDict if port is None: port=findFileDict() filedict = getPiDict(port) + #filedict = getPiDict(port).encode() try: - with open(filedict, 'r') as fpid: + with open(filedict, 'rb') as fpid: process_ids=pickle.load(fpid) except: process_ids=[] @@ -78,7 +79,7 @@ def addToKillList(command_pid, command, port=None): process_ids.append({int(command_pid): [command]}) dir = os.path.dirname(filedict) if not os.path.exists(dir): os.makedirs(dir, 0o777) - with open(filedict,'w') as fpid: + with open(filedict,'wb') as fpid: pickle.dump(process_ids, fpid) except: if verbose(): print("addToKillList: can not add command %s : %s to the kill list" % ( str(command_pid), command )) @@ -102,7 +103,7 @@ def killList(port=None): if not os.path.exists(filedict): filedict = getPiDict(port, hidden=False) try: - with open(filedict, 'r') as fpid: + with open(filedict, 'rb') as fpid: process_ids=pickle.load(fpid) except: process_ids=[] diff --git a/bin/killSalomeWithPort.py b/bin/killSalomeWithPort.py index 8ed6794b2..7af50cf55 100755 --- a/bin/killSalomeWithPort.py +++ b/bin/killSalomeWithPort.py @@ -228,7 +228,7 @@ def __killMyPort(port, filedict): port = int(port) try: - with open(filedict, 'r') as fpid: + with open(filedict, 'rb') as fpid: process_ids=pickle.load(fpid) for process_id in process_ids: for pid, cmd in list(process_id.items()):