]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
Fix salome killall
authorNicolas Geimer <nicolas.geimer@edf.fr>
Wed, 19 Apr 2017 12:52:07 +0000 (14:52 +0200)
committerNicolas Geimer <nicolas.geimer@edf.fr>
Wed, 19 Apr 2017 12:52:07 +0000 (14:52 +0200)
bin/PortManager.py
bin/addToKillList.py
bin/killSalomeWithPort.py

index f838a2ddf080c03a7d9185f8c625c0121970aa86..0c0c6ec7b1d684aa08f71220c7823631b8cb2a4f 100644 (file)
@@ -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)
 
index 06a32f46b4dbc81b2df4bfda25dc68b2e18b2ccd..9be099991e687e0ce34870fb48d3befb2ee79cd7 100755 (executable)
@@ -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=[]
index 8ed6794b2ff9fc591f6f20c26bba9ec8e2bb357c..7af50cf5530eb35603612c3d44ccf0195f479c6f 100755 (executable)
@@ -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()):