Skip to content

Commit b78d87f

Browse files
authored
move suppression of KeyboardInterrupt (#82)
1 parent 81f0617 commit b78d87f

File tree

2 files changed

+3
-9
lines changed

2 files changed

+3
-9
lines changed

launch/launch/launch_service.py

+2
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,8 @@ def _on_sigquit(signum, frame):
337337
while not run_loop_task.done():
338338
try:
339339
self.__loop_from_run_thread.run_until_complete(run_loop_task)
340+
except KeyboardInterrupt:
341+
pass
340342
except asyncio.CancelledError:
341343
_logger.error('asyncio run loop was canceled')
342344
finally:

launch/launch/utilities/signal_management.py

+1-9
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,6 @@ def install_signal_handlers():
101101
If you register signal handlers before calling this function, then your
102102
signal handler will automatically be called by the signal handlers in this
103103
thread.
104-
If your handler for SIGINT raises KeyboardInterrupt, and a custom handler
105-
for SIGINT has been set with on_sigint, then that exception will be
106-
suppressed.
107104
"""
108105
global __signal_handlers_installed_lock, __signal_handlers_installed
109106
with __signal_handlers_installed_lock:
@@ -120,12 +117,7 @@ def __on_sigint(signum, frame):
120117
if callable(__custom_sigint_handler):
121118
__custom_sigint_handler(signum, frame)
122119
if callable(__original_sigint_handler):
123-
try:
124-
__original_sigint_handler(signum, frame)
125-
except KeyboardInterrupt:
126-
if __custom_sigint_handler is None:
127-
# Suppress KeyboardInterrupt unless there is no custom handler.
128-
raise
120+
__original_sigint_handler(signum, frame)
129121

130122
if platform.system() != 'Windows':
131123
# Windows does not support SIGQUIT

0 commit comments

Comments
 (0)