()
| 227 | seconds: int, |
| 228 | ) -> threading.Thread: # 60 seconds default timeout |
| 229 | def deadman_timer() -> None: |
| 230 | # Unconditional second-tier kill: if the primary watchdog gets stuck |
| 231 | # in dump_thread_stacks() / psutil queries / blocked I/O, this fires |
| 232 | # _DEADMAN_GRACE_S later and exits without running any diagnostics. |
| 233 | time.sleep(seconds + _DEADMAN_GRACE_S) |
| 234 | if _CANCEL_WATCHDOG.is_set(): |
| 235 | return |
| 236 | try: |
| 237 | _release_held_build_locks() |
| 238 | except KeyboardInterrupt as ki: |
| 239 | # Suppress: the unconditional os._exit() below is the entire point |
| 240 | # of the deadman timer. Re-raising would defeat it. |
| 241 | handle_keyboard_interrupt(ki) |
| 242 | except Exception: |
| 243 | pass |
| 244 | os._exit(3) # Exit code 3 = deadman fired (primary watchdog also stuck) |
| 245 | |
| 246 | def watchdog_timer() -> None: |
| 247 | time.sleep(seconds) |
nothing calls this directly
no test coverage detected