fix: make pty_resize sync function callable with no arguments
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:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user