From c4054cf810bd6ae66eff6f877a6c55c72f0f5f63 Mon Sep 17 00:00:00 2001 From: Jeremy Date: Mon, 4 May 2015 12:14:04 -0600 Subject: [PATCH] Catch the "WinError 0 The operation completed successfully" exception at a higher level. --- gns3server/main.py | 4 ++++ gns3server/server.py | 5 ----- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/gns3server/main.py b/gns3server/main.py index ee32440f..30360876 100644 --- a/gns3server/main.py +++ b/gns3server/main.py @@ -181,6 +181,10 @@ def main(): server = Server.instance(host, port) try: 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: + raise except Exception as e: log.critical("Critical error while running the server: {}".format(e), exc_info=1) CrashReport.instance().capture_exception() diff --git a/gns3server/server.py b/gns3server/server.py index 0dd5d641..dca8ff29 100644 --- a/gns3server/server.py +++ b/gns3server/server.py @@ -225,11 +225,6 @@ class Server: try: self._loop.run_forever() - 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: - raise except TypeError as e: # This is to ignore an asyncio.windows_events exception # on Windows when the process gets the SIGBREAK signal