mirror of
https://github.com/internetarchive/brozzler.git
synced 2025-02-24 08:39:59 -05:00
without sudo, psutil.net_connections() raises psutil.AccessDenied on mac; in this case, silently try running chrome on the unvetted configured port
This commit is contained in:
parent
1141c5951e
commit
317a5eb99d
@ -157,9 +157,14 @@ class Browser:
|
|||||||
port_available = False
|
port_available = False
|
||||||
port = self.chrome_port
|
port = self.chrome_port
|
||||||
|
|
||||||
for p in range(port,65535):
|
try:
|
||||||
if any(connection.laddr[1] == p for connection in psutil.net_connections(kind='tcp')):
|
conns = psutil.net_connections(kind="tcp")
|
||||||
self.logger.warn("Port already open %s, will try %s", p, p + 1)
|
except psutil.AccessDenied:
|
||||||
|
return port
|
||||||
|
|
||||||
|
for p in range(port, 65535):
|
||||||
|
if any(connection.laddr[1] == p for connection in conns):
|
||||||
|
self.logger.warn("port %s already open, will try %s", p, p+1)
|
||||||
else:
|
else:
|
||||||
port = p
|
port = p
|
||||||
break
|
break
|
||||||
|
Loading…
x
Reference in New Issue
Block a user