Commit b8212c29 authored by Gabriel Monnerat's avatar Gabriel Monnerat

refactor code to prevent AccessDenied exception when get_connections() is called

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk/utils@43261 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent c3d2b520
...@@ -85,13 +85,12 @@ class Application(object): ...@@ -85,13 +85,12 @@ class Application(object):
process = Process(pid) process = Process(pid)
try: try:
process.exe for connection in process.get_connections():
if connection.status == 'LISTEN' and connection.local_address[1] == self.port:
return True
except AccessDenied: except AccessDenied:
return False return False
for connection in process.get_connections():
if connection.status == 'LISTEN' and connection.local_address[1] == self.port:
return True
return False return False
def getAddress(self): def getAddress(self):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment