fix: make pty_resize sync function callable with no arguments
lint / lint (push) Successful in 1m26s
test / unit (pull_request) Successful in 34s
test / integration (pull_request) Successful in 44s

The sync() function is used in two contexts:
1. As a signal handler: signal.signal(signal.SIGWINCH, sync)
   - Called with (signum: int, frame: FrameType | None)
2. As a threading.Timer callback: Timer(..., sync)
   - Called with no arguments

Made parameters optional with defaults to support both call patterns.
Added type: ignore for signal.signal() since the type signature differs.

Fixes: TypeError when Timer tries to call sync() with no arguments.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-06-04 12:12:57 -04:00
parent 82b8dffc54
commit 059bba8c4f
@@ -124,13 +124,13 @@ def main(argv: list[str]) -> int:
machine = argv[0]
inner = argv[2:]
def sync(_signum: int, _frame: FrameType | None) -> None:
def sync(_signum: int | None = None, _frame: FrameType | None = None) -> None:
size = _read_winsize()
if size is None:
return
_push_size(machine, *size)
signal.signal(signal.SIGWINCH, sync)
signal.signal(signal.SIGWINCH, sync) # type: ignore[arg-type]
proc = subprocess.Popen(inner)
# Initial sync is deferred — see _STARTUP_SYNC_DELAY_SEC.