From 89971478489afe7e417ec065af5ce9934facd429 Mon Sep 17 00:00:00 2001 From: Kristaps Kaupe Date: Wed, 20 May 2020 20:18:57 +0300 Subject: [PATCH] Terminate ob-watcher immediately if HTTP server fails to start --- scripts/obwatch/ob-watcher.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/obwatch/ob-watcher.py b/scripts/obwatch/ob-watcher.py index 4c102b2..1088a6e 100644 --- a/scripts/obwatch/ob-watcher.py +++ b/scripts/obwatch/ob-watcher.py @@ -372,8 +372,12 @@ class HTTPDThread(threading.Thread): def run(self): # hostport = ('localhost', 62601) - httpd = http.server.HTTPServer(self.hostport, + try: + httpd = http.server.HTTPServer(self.hostport, OrderbookPageRequestHeader) + except Exception as e: + print("Failed to start HTTP server: " + str(e)) + os._exit(EXIT_FAILURE) httpd.taker = self.taker print('\nstarted http server, visit http://{0}:{1}/\n'.format( *self.hostport))