]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
#17872 [CEA] /tmp/.salome_PortManager.lock permission denied
authorvsr <vsr@opencascade.com>
Mon, 21 Oct 2019 08:04:03 +0000 (11:04 +0300)
committervsr <vsr@opencascade.com>
Mon, 21 Oct 2019 08:04:03 +0000 (11:04 +0300)
bin/PortManager.py

index 0b8dd94c1ff79654328f583d1c518bb57572a481..e0584ac81529000f029ad5267f0b1b6a66dbd8b9 100644 (file)
@@ -83,6 +83,11 @@ def _getConfigurationFilename():
   import tempfile
   temp = tempfile.NamedTemporaryFile()
   lock_file = os.path.join(os.path.dirname(temp.name), ".salome_PortManager.lock")
+  try:
+    with open(lock_file, 'wb'):
+      pass
+  except IOError:
+    pass
   temp.close()
 
   return (portmanager_config, lock_file)
@@ -137,7 +142,7 @@ def getPort(preferredPort=None):
 
   config_file, lock_file = _getConfigurationFilename()
   oldmask = os.umask(0)
-  with open(lock_file, 'wb') as lock:
+  with open(lock_file, 'rb') as lock:
     # acquire lock
     __acquire_lock(lock)
 
@@ -196,7 +201,7 @@ def releasePort(port):
 
   config_file, lock_file = _getConfigurationFilename()
   oldmask = os.umask(0)
-  with open(lock_file, 'wb') as lock:
+  with open(lock_file, 'rb') as lock:
     # acquire lock
     __acquire_lock(lock)