diff --git a/launch/launch/launch_service.py b/launch/launch/launch_service.py index 0c1d192f0..19e111306 100644 --- a/launch/launch/launch_service.py +++ b/launch/launch/launch_service.py @@ -337,6 +337,8 @@ def _on_sigquit(signum, frame): while not run_loop_task.done(): try: self.__loop_from_run_thread.run_until_complete(run_loop_task) + except KeyboardInterrupt: + pass except asyncio.CancelledError: _logger.error('asyncio run loop was canceled') finally: diff --git a/launch/launch/utilities/signal_management.py b/launch/launch/utilities/signal_management.py index bbd6554c0..b11a118d2 100644 --- a/launch/launch/utilities/signal_management.py +++ b/launch/launch/utilities/signal_management.py @@ -101,9 +101,6 @@ def install_signal_handlers(): If you register signal handlers before calling this function, then your signal handler will automatically be called by the signal handlers in this thread. - If your handler for SIGINT raises KeyboardInterrupt, and a custom handler - for SIGINT has been set with on_sigint, then that exception will be - suppressed. """ global __signal_handlers_installed_lock, __signal_handlers_installed with __signal_handlers_installed_lock: @@ -120,12 +117,7 @@ def __on_sigint(signum, frame): if callable(__custom_sigint_handler): __custom_sigint_handler(signum, frame) if callable(__original_sigint_handler): - try: - __original_sigint_handler(signum, frame) - except KeyboardInterrupt: - if __custom_sigint_handler is None: - # Suppress KeyboardInterrupt unless there is no custom handler. - raise + __original_sigint_handler(signum, frame) if platform.system() != 'Windows': # Windows does not support SIGQUIT