From 2acabbfb8d9da0506813d2faf38b222d2d0ceb94 Mon Sep 17 00:00:00 2001 From: alemidev Date: Fri, 17 Dec 2021 16:36:38 +0100 Subject: [PATCH] ops forgot to check signum --- aiocraft/traits/runnable.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/aiocraft/traits/runnable.py b/aiocraft/traits/runnable.py index 12ecb23..55b275a 100644 --- a/aiocraft/traits/runnable.py +++ b/aiocraft/traits/runnable.py @@ -22,13 +22,14 @@ class Runnable: DONE = asyncio.Event() FORCE_QUIT = asyncio.Event() - def signal_handler(): - if DONE.is_set(): - logging.info("Received SIGINT, terminating") - FORCE_QUIT.set() - else: - logging.info("Received SIGINT, stopping gracefully...") - DONE.set() + def signal_handler(signum, __): + if signum == SIGINT: + if DONE.is_set(): + logging.info("Received SIGINT, terminating") + FORCE_QUIT.set() + else: + logging.info("Received SIGINT, stopping gracefully...") + DONE.set() signal(SIGINT, signal_handler)