File tree Expand file tree Collapse file tree
controller_manager/controller_manager Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1616import argparse
1717import errno
1818import os
19+ import signal
1920import sys
2021import time
2122import warnings
@@ -310,6 +311,11 @@ def main(args=None):
310311 while True :
311312 time .sleep (1 )
312313 except KeyboardInterrupt :
314+ # Ignore further SIGINTs so a second signal cannot interrupt cleanup.
315+ # Without this, a signal delivered while rclpy's C extension returns to
316+ # Python can raise a second KeyboardInterrupt inside the except block,
317+ # skipping the deactivate/unload calls and leaving controllers loaded.
318+ signal .signal (signal .SIGINT , signal .SIG_IGN )
313319 if not args .stopped and not args .inactive :
314320 node .get_logger ().info ("Interrupt captured, deactivating and unloading controller" )
315321 # TODO(saikishor) we might have an issue in future, if any of these controllers is in chained mode
You can’t perform that action at this time.
0 commit comments