run-dev: Make address-in-use errors more obvious.

This seems to be a common enough pitfall to justify
a bit of extra handling.  Example output:

    $ ./tools/run-dev.py
    Clearing memcached ...
    Flushing memcached...
    OK
    Starting Zulip services on ports: web proxy: ...
    Note: only port 9991 is exposed to the host in a Vagrant environment.

    ERROR: You probably have another server running!!!

    Traceback (most recent call last):
      File "./tools/run-dev.py", line 421, in <module>
        app.listen(proxy_port, address=options.interface)
      File "/srv/zulip-py3-venv/lib/python3.5/...
        server.listen(port, address)
      File "/srv/zulip-py3-venv/lib/python3.5/...
        sockets = bind_sockets(port, address=address)
      File "/srv/zulip-py3-venv/lib/python3.5/...
        sock.bind(sockaddr)
    OSError: [Errno 98] Address already in use
    Terminated
This commit is contained in:
Steve Howell 2019-01-29 19:28:48 +00:00 committed by Tim Abbott
parent 837483b026
commit c665f809f2
1 changed files with 6 additions and 1 deletions

View File

@ -417,7 +417,12 @@ print("".join((WARNING,
try:
app = Application(enable_logging=options.enable_tornado_logging)
try:
app.listen(proxy_port, address=options.interface)
except OSError as e:
if e.errno == 98:
print('\n\nERROR: You probably have another server running!!!\n\n')
raise
ioloop = IOLoop.instance()
for s in (signal.SIGINT, signal.SIGTERM):
signal.signal(s, shutdown_handler)