]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
[EDF-12448] Only search in TCP ports (avoid "oserror [Errno 7] Argument list too... V7_8_0a2
authorCédric Aguerre <cedric.aguerre@edf.fr>
Mon, 29 Feb 2016 10:40:39 +0000 (11:40 +0100)
committerCédric Aguerre <cedric.aguerre@edf.fr>
Wed, 20 Apr 2016 07:30:28 +0000 (09:30 +0200)
bin/PortManager.py

index 999166106bffc0923c2fdc7760553b431d2b28b5..a3b24a0f1c8e34f1c66ce9e7f6263753f168d47d 100644 (file)
@@ -89,7 +89,10 @@ def __isNetworkConnectionActiveOnPort(port):
   #        netstat options -l and -t are unavailable
   #        grep command is unavailable
   from subprocess import Popen, PIPE
-  stdout, _ = Popen(['netstat','-an'], stdout=PIPE).communicate()
+  if sys.platform == "win32":
+    stdout, _ = Popen(['netstat','-a','-n','-p tcp'], stdout=PIPE).communicate()
+  else:
+    stdout, _ = Popen(['netstat','-ant'], stdout=PIPE).communicate()
   import StringIO
   buf = StringIO.StringIO(stdout)
   ports = buf.readlines()
@@ -102,6 +105,7 @@ def __isNetworkConnectionActiveOnPort(port):
       if p == port: return True
     except:
       pass
+  return False
 #
 
 def getPort(preferedPort=None):