From d244df5ba1edbe863f61bf6a02aacd71a5388834 Mon Sep 17 00:00:00 2001 From: Krrisha Patel Date: Sat, 27 Jun 2026 00:11:02 -0700 Subject: [PATCH] Include real-time signals in SIGNUMS On Linux, signal numbers SIGRTMIN through SIGRTMAX (typically 34-64) are valid but have no named constants in the signal module. The existing list comprehension only collects SIG* attributes, causing signal_number() to reject real-time signals with "not a valid signal number". Extend SIGNUMS with the SIGRTMIN..SIGRTMAX range when those attributes are available. --- supervisor/datatypes.py | 2 ++ supervisor/tests/test_datatypes.py | 12 ++++++++++++ 2 files changed, 14 insertions(+) diff --git a/supervisor/datatypes.py b/supervisor/datatypes.py index 7fa0dc2fe..8679959bc 100644 --- a/supervisor/datatypes.py +++ b/supervisor/datatypes.py @@ -404,6 +404,8 @@ def url(value): # all valid signal numbers SIGNUMS = [ getattr(signal, k) for k in dir(signal) if k.startswith('SIG') ] +if hasattr(signal, 'SIGRTMIN') and hasattr(signal, 'SIGRTMAX'): + SIGNUMS.extend(range(signal.SIGRTMIN, signal.SIGRTMAX + 1)) def signal_number(value): try: diff --git a/supervisor/tests/test_datatypes.py b/supervisor/tests/test_datatypes.py index b7f092f7c..ae34108dd 100644 --- a/supervisor/tests/test_datatypes.py +++ b/supervisor/tests/test_datatypes.py @@ -750,6 +750,18 @@ def test_raises_for_bad_name(self): expected = "value 'BADSIG' is not a valid signal name" self.assertEqual(e.args[0], expected) + @unittest.skipUnless( + hasattr(signal, 'SIGRTMIN'), 'real-time signals not available' + ) + def test_accepts_realtime_signal_number(self): + self.assertEqual(self._callFUT(signal.SIGRTMIN), signal.SIGRTMIN) + + @unittest.skipUnless( + hasattr(signal, 'SIGRTMAX'), 'real-time signals not available' + ) + def test_accepts_realtime_signal_max(self): + self.assertEqual(self._callFUT(signal.SIGRTMAX), signal.SIGRTMAX) + class AutoRestartTests(unittest.TestCase): def _callFUT(self, arg): return datatypes.auto_restart(arg)