Catch cancelled error when you Ctrl-C during server initalisation

Fix #820
This commit is contained in:
Julien Duponchelle 2016-12-12 10:17:45 +01:00
parent 4cd08c8955
commit d16e3bb37b
No known key found for this signature in database
GPG Key ID: CE8B29639E07F5E8

View File

@ -81,7 +81,7 @@ class WebServer:
try: try:
srv = self._loop.create_server(handler, self._host, self._port, ssl=ssl_context) srv = self._loop.create_server(handler, self._host, self._port, ssl=ssl_context)
self._server, startup_res = self._loop.run_until_complete(asyncio.gather(srv, self._app.startup(), loop=self._loop)) self._server, startup_res = self._loop.run_until_complete(asyncio.gather(srv, self._app.startup(), loop=self._loop))
except OSError as e: except (OSError, asyncio.CancelledError) as e:
log.critical("Could not start the server: {}".format(e)) log.critical("Could not start the server: {}".format(e))
return False return False
return True return True