diff --git a/launch/launch/utilities/signal_management.py b/launch/launch/utilities/signal_management.py index 992bfbf04..bdc153dd5 100644 --- a/launch/launch/utilities/signal_management.py +++ b/launch/launch/utilities/signal_management.py @@ -232,7 +232,7 @@ def handle( :return: previous handler if any, otherwise None """ signum = signal.Signals(signum) - signal.signal(signum, signal.default_int_handler) + signal.signal(signum, lambda signal, frame: None) if handler is not None: if not callable(handler): raise ValueError('signal handler must be a callable') diff --git a/launch/test/launch/utilities/test_signal_management.py b/launch/test/launch/utilities/test_signal_management.py index 15ceffcd4..59b1d19f8 100644 --- a/launch/test/launch/utilities/test_signal_management.py +++ b/launch/test/launch/utilities/test_signal_management.py @@ -31,12 +31,10 @@ def _wrapper(*args, **kwargs): handlers = {} try: for s in signals: - handlers[s] = signal.signal(s, signal.default_int_handler) + handlers[s] = signal.signal(s, lambda signal, frame: None) return func(*args, **kwargs) - except KeyboardInterrupt: - pass finally: - assert all(signal.signal(s, h) is signal.default_int_handler + assert all(signal.signal(s, h) is (lambda signal, frame: None) for s, h in handlers.items()) return _wrapper