mirror of
https://github.com/jupyter/notebook.git
synced 2025-03-01 12:56:54 +08:00
Workaround for socket permission errors on Cygwin (#4584)
* Workaround for wrong errno on socket bind permission errors on Cygwin. * [ci skip] Add period to comment Co-authored-by: Steven Silvester <stslve@amazon.com>
This commit is contained in:
parent
dbfa82c3e7
commit
8e7c99ad8d
@ -1725,13 +1725,20 @@ class NotebookApp(JupyterApp):
|
||||
try:
|
||||
self.http_server.listen(port, self.ip)
|
||||
except socket.error as e:
|
||||
eacces = (errno.EACCES, getattr(errno, 'WSAEACCES', errno.EACCES))
|
||||
if sys.platform == 'cygwin':
|
||||
# Cygwin has a bug that causes EPERM to be returned in this
|
||||
# case instead of EACCES:
|
||||
# https://cygwin.com/ml/cygwin/2019-04/msg00160.html
|
||||
eacces += (errno.EPERM,)
|
||||
|
||||
if e.errno == errno.EADDRINUSE:
|
||||
if self.port_retries:
|
||||
self.log.info(_('The port %i is already in use, trying another port.') % port)
|
||||
else:
|
||||
self.log.info(_('The port %i is already in use.') % port)
|
||||
continue
|
||||
elif e.errno in (errno.EACCES, getattr(errno, 'WSAEACCES', errno.EACCES)):
|
||||
elif e.errno in eacces:
|
||||
self.log.warning(_("Permission to listen on port %i denied.") % port)
|
||||
continue
|
||||
else:
|
||||
|
Loading…
Reference in New Issue
Block a user