Debian Codegraph @

test/data/signal_ignorer.py

raw symbols SCIP
1 #!/usr/bin/env python3
2 import signal
3 import time
4 from types import FrameType
5 from typing import Optional
6
7
8 def handle_signal(sig: int, _frame: Optional[FrameType]) -> None:
9 print(f"Received {sig}")
10
11
12 if __name__ == "__main__":
13 signal.signal(signal.SIGINT, handle_signal)
14 signal.siginterrupt(
15 signal.SIGINT, False
16 ) # Restart interrupted system calls so we can test multiple SIGINTS
17 t0 = time.time()
18 while time.time() - t0 < 10:
19 time.sleep(0.01)