From ac246fda184da774d31e9403f8cd05eb58a55b16 Mon Sep 17 00:00:00 2001 From: Ben Date: Wed, 29 May 2019 22:44:13 +0100 Subject: [PATCH] Shutdown more gracefully for KeyboardInterrupt --- bootstrap.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/bootstrap.py b/bootstrap.py index 9293360..9a4bc2a 100644 --- a/bootstrap.py +++ b/bootstrap.py @@ -1,5 +1,6 @@ import asyncio import sys +import logging from houdini.houdini import HoudiniFactory if __name__ == '__main__': @@ -7,5 +8,9 @@ if __name__ == '__main__': loop = asyncio.ProactorEventLoop() asyncio.set_event_loop(loop) + logger = logging.getLogger('houdini') factory_instance = HoudiniFactory(server='Login') - asyncio.run(factory_instance.start()) + try: + asyncio.run(factory_instance.start()) + except KeyboardInterrupt: + logger.info('Shutting down...')