Shutdown more gracefully for KeyboardInterrupt

This commit is contained in:
Ben 2019-05-29 22:44:13 +01:00
parent fa8abed189
commit ac246fda18

View File

@ -1,5 +1,6 @@
import asyncio import asyncio
import sys import sys
import logging
from houdini.houdini import HoudiniFactory from houdini.houdini import HoudiniFactory
if __name__ == '__main__': if __name__ == '__main__':
@ -7,5 +8,9 @@ if __name__ == '__main__':
loop = asyncio.ProactorEventLoop() loop = asyncio.ProactorEventLoop()
asyncio.set_event_loop(loop) asyncio.set_event_loop(loop)
logger = logging.getLogger('houdini')
factory_instance = HoudiniFactory(server='Login') factory_instance = HoudiniFactory(server='Login')
asyncio.run(factory_instance.start()) try:
asyncio.run(factory_instance.start())
except KeyboardInterrupt:
logger.info('Shutting down...')