Skip to content

Commit

Permalink
move suppression of KeyboardInterrupt (#82)
Browse files Browse the repository at this point in the history
  • Loading branch information
wjwwood authored Jul 11, 2018
1 parent 81f0617 commit b78d87f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
2 changes: 2 additions & 0 deletions launch/launch/launch_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
10 changes: 1 addition & 9 deletions launch/launch/utilities/signal_management.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down

0 comments on commit b78d87f

Please sign in to comment.