Ignore sigint while draining the tty

This commit is contained in:
Kovid Goyal 2022-07-20 19:40:23 +05:30
parent 7215c6d6be
commit ef2a12fbdf
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -605,6 +605,7 @@ def drain_potential_tty_garbage(p: 'subprocess.Popen[bytes]', data_request: str)
give_up_at = time.monotonic() + 2 give_up_at = time.monotonic() + 2
tty_fd = tty.fileno() tty_fd = tty.fileno()
while time.monotonic() < give_up_at and canary not in data: while time.monotonic() < give_up_at and canary not in data:
with suppress(KeyboardInterrupt):
rd, wr, err = select([tty_fd], [], [tty_fd], max(0, give_up_at - time.monotonic())) rd, wr, err = select([tty_fd], [], [tty_fd], max(0, give_up_at - time.monotonic()))
if err or not rd: if err or not rd:
break break