Salome HOME
Fix problem with waiting SALOMEDS_Server:
[modules/kernel.git] / bin / PortManager.py
index a3b24a0f1c8e34f1c66ce9e7f6263753f168d47d..3d7e63c401d07c7b4c996a84a34a07ab6d9520f4 100644 (file)
@@ -44,7 +44,7 @@ def createLogger():
 logger = createLogger()
 
 #------------------------------------
-# A file locker (Linux only)
+# A file locker
 def __acquire_lock(lock):
   if sys.platform == "win32":
     import msvcrt
@@ -62,6 +62,7 @@ def __release_lock(lock):
     import fcntl
     fcntl.flock(lock, fcntl.LOCK_UN)
 #
+#------------------------------------
 
 def _getConfigurationFilename():
   omniorbUserPath = os.getenv("OMNIORB_USER_PATH")
@@ -90,11 +91,11 @@ def __isNetworkConnectionActiveOnPort(port):
   #        grep command is unavailable
   from subprocess import Popen, PIPE
   if sys.platform == "win32":
-    stdout, _ = Popen(['netstat','-a','-n','-p tcp'], stdout=PIPE).communicate()
+    out, _ = Popen(['netstat','-a','-n','-p tcp'], stdout=PIPE).communicate()
   else:
-    stdout, _ = Popen(['netstat','-ant'], stdout=PIPE).communicate()
+    out, _ = Popen(['netstat','-ant'], stdout=PIPE).communicate()
   import StringIO
-  buf = StringIO.StringIO(stdout)
+  buf = StringIO.StringIO(out)
   ports = buf.readlines()
   # search for TCP - LISTEN connections
   import re
@@ -204,7 +205,7 @@ def releasePort(port):
     __release_lock(lock)
 
     logger.debug("released port port: %s"%str(port))
-  
+
   os.umask(oldmask)
 #