KeybordInterrupt handling in non-pytest, .py scripts
Consider such an example:
import time
import test_tools as tt
node = tt.InitNode()
node.run()
while True:
print("serving...")
time.sleep(1)
When sending c-c, we can observe not very nice
closedown message that bring up @agrabowska attention (also FYI) of:
^CException ignored in: <module 'threading' from '/home/mzebrak/.pyenv/versions/3.10.12/lib/python3.10/threading.py'>
Traceback (most recent call last):
File "/home/mzebrak/.pyenv/versions/3.10.12/lib/python3.10/threading.py", line 1567, in _shutdown
lock.acquire()
File "/home/mzebrak/1workspace/clive/hive/tests/python/hive-local-tools/test-tools/package/test_tools/__private/raise_exception_helper.py", line 22, in __external_error_handler
signal.default_int_handler(signal_number, current_stack_frame)
KeyboardInterrupt:
and we cannot simply catch it via try ... except KeyboardInterrupt pass
block