mirror of
https://github.com/GNS3/gns3-server
synced 2024-11-13 20:08:55 +00:00
Return exit status 1 if server fails to start. Fixes #1744
This commit is contained in:
parent
8536af33da
commit
72c6f5b484
@ -259,8 +259,9 @@ def run():
|
||||
port = int(server_config["port"])
|
||||
|
||||
server = WebServer.instance(host, port)
|
||||
status = 0
|
||||
try:
|
||||
server.run()
|
||||
status = server.run()
|
||||
except OSError as e:
|
||||
# This is to ignore OSError: [WinError 0] The operation completed successfully exception on Windows.
|
||||
if not sys.platform.startswith("win") and not e.winerror == 0:
|
||||
@ -269,10 +270,10 @@ def run():
|
||||
log.critical("Critical error while running the server: {}".format(e), exc_info=1)
|
||||
CrashReport.instance().capture_exception()
|
||||
return
|
||||
|
||||
if args.pid:
|
||||
log.info("Remove PID file %s", args.pid)
|
||||
try:
|
||||
os.remove(args.pid)
|
||||
except OSError as e:
|
||||
log.critical("Can't remove pid file %s: %s", args.pid, str(e))
|
||||
finally:
|
||||
if args.pid:
|
||||
log.info("Remove PID file %s", args.pid)
|
||||
try:
|
||||
os.remove(args.pid)
|
||||
except OSError as e:
|
||||
log.critical("Can't remove pid file %s: %s", args.pid, str(e))
|
||||
|
@ -296,7 +296,7 @@ class WebServer:
|
||||
self._handler = self._app.make_handler()
|
||||
if self._run_application(self._handler, ssl_context) is False:
|
||||
self._loop.stop()
|
||||
return
|
||||
sys.exit(1)
|
||||
|
||||
self._signal_handling()
|
||||
self._exit_handling()
|
||||
@ -317,3 +317,4 @@ class WebServer:
|
||||
self._loop.run_until_complete(self.shutdown_server())
|
||||
except asyncio.CancelledError:
|
||||
pass
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user