ssh kitten: Allow pressing Ctrl-C to abort ssh before the connection is completed

Fixing this involved adding a new mode to kitty where it handles
ctrl-c/z/q by sending signals to the tty foreground process group
instead of delegating to the kernel to do that. Since the pipe may be
full we have no way of knowing when the kernel will get around to
reading the signal byte. So send the signal ourselves.

Fixes #5271
This commit is contained in:
Kovid Goyal
2022-07-20 19:11:14 +05:30
parent bd9e1f58fe
commit 7215c6d6be
9 changed files with 62 additions and 2 deletions

View File

@@ -857,6 +857,13 @@ class Window:
'--ssh-connection-data', json.dumps(conn_data)
)
def send_signal_for_key(self, key_num: int) -> bool:
try:
return self.child.send_signal_for_key(key_num)
except OSError as err:
log_error(f'Failed to send signal for key to child with err: {err}')
return False
def focus_changed(self, focused: bool) -> None:
if self.destroyed:
return