Show More
@@ -272,14 +272,11 b' def checkportisavailable(port):' | |||
|
272 | 272 | with contextlib.closing(socket.socket(family, socket.SOCK_STREAM)) as s: |
|
273 | 273 | s.bind(('localhost', port)) |
|
274 | 274 | return True |
|
275 | except PermissionError: | |
|
276 | return False | |
|
275 | 277 | except socket.error as exc: |
|
276 | 278 | if WINDOWS and exc.errno == errno.WSAEACCES: |
|
277 | 279 | return False |
|
278 | # TODO: make a proper exception handler after dropping py2. This | |
|
279 | # works because socket.error is an alias for OSError on py3, | |
|
280 | # which is also the baseclass of PermissionError. | |
|
281 | elif isinstance(exc, PermissionError): | |
|
282 | return False | |
|
283 | 280 | if exc.errno not in ( |
|
284 | 281 | errno.EADDRINUSE, |
|
285 | 282 | errno.EADDRNOTAVAIL, |
General Comments 0
You need to be logged in to leave comments.
Login now