Skip to content

Commit

Permalink
Add assertions for handlers to ensure mypy is happy
Browse files Browse the repository at this point in the history
  • Loading branch information
RealOrangeOne committed Aug 13, 2023
1 parent 325a2f8 commit a363153
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions sbot/timeout.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ def timeout_handler(signal_type: int, stack_frame: Optional[FrameType]) -> None:
:param signal_type: The sginal that triggered this handler
:param stack_frame: The stack frame at the time of the signal
"""
assert sys.platform != 'win32'

logger.info(TIMEOUT_MESSAGE)

# If the process doesn't terminate in a given time, exit less cleanly
Expand All @@ -46,6 +48,8 @@ def win_timeout_handler() -> None:
NOTE: This function is only called on Windows.
"""
assert sys.platform == 'win32'

logger.info(TIMEOUT_MESSAGE)
os.kill(os.getpid(), signal.SIGTERM)

Expand Down

0 comments on commit a363153

Please sign in to comment.