From 2bacee3a07c137eae84377b466b302a8c63a61fa Mon Sep 17 00:00:00 2001 From: Lars-Dominik Braun Date: Sun, 29 Dec 2019 15:13:47 +0100 Subject: cli: Ignore future cancellation on the top level --- crocoite/cli.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'crocoite') diff --git a/crocoite/cli.py b/crocoite/cli.py index 53a0b32..04bbb19 100644 --- a/crocoite/cli.py +++ b/crocoite/cli.py @@ -202,8 +202,12 @@ def recursive (): stop = lambda signum: run.cancel () loop.add_signal_handler (signal.SIGINT, stop, signal.SIGINT) loop.add_signal_handler (signal.SIGTERM, stop, signal.SIGTERM) - loop.run_until_complete(run) - loop.close() + try: + loop.run_until_complete(run) + except asyncio.CancelledError: + pass + finally: + loop.close() return 0 -- cgit v1.2.3