mirror of
https://github.com/kovidgoyal/kitty.git
synced 2026-05-13 08:26:56 +00:00
Fix regression that broke quick exit from ssh kitten
This commit is contained in:
parent
ac2ec44a7f
commit
bd5fcb00e0
3 changed files with 9 additions and 6 deletions
|
|
@ -524,16 +524,20 @@ func get_remote_command(cd *connection_data) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
var debugprintln = tty.DebugPrintln
|
||||
var _ = debugprintln
|
||||
|
||||
func drain_potential_tty_garbage(term *tty.Term) {
|
||||
err := term.ApplyOperations(tty.TCSANOW, tty.SetNoEcho)
|
||||
err := term.ApplyOperations(tty.TCSANOW, tty.SetRaw)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
canary, err := secrets.TokenBase64()
|
||||
canary, err := secrets.TokenHex()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
dcs, err := tui.DCSToKitty("echo", canary+"\n\r")
|
||||
dcs, err := tui.DCSToKitty("echo", canary)
|
||||
q := utils.UnsafeStringToBytes(canary)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
|
@ -541,7 +545,6 @@ func drain_potential_tty_garbage(term *tty.Term) {
|
|||
if err != nil {
|
||||
return
|
||||
}
|
||||
q := utils.UnsafeStringToBytes(canary)
|
||||
data := make([]byte, 0)
|
||||
give_up_at := time.Now().Add(2 * time.Second)
|
||||
buf := make([]byte, 0, 8192)
|
||||
|
|
@ -553,7 +556,7 @@ func drain_potential_tty_garbage(term *tty.Term) {
|
|||
}
|
||||
n, err := term.ReadWithTimeout(buf, timeout)
|
||||
if err != nil {
|
||||
return
|
||||
break
|
||||
}
|
||||
data = append(data, buf[:n]...)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1194,6 +1194,7 @@ class Window:
|
|||
def handle_remote_echo(self, msg: str) -> None:
|
||||
from base64 import standard_b64decode
|
||||
data = standard_b64decode(msg)
|
||||
data = re.sub(rb'[^a-zA-Z0-9]', b'', data)
|
||||
self.write_to_child(data)
|
||||
|
||||
def handle_remote_ssh(self, msg: str) -> None:
|
||||
|
|
|
|||
|
|
@ -74,7 +74,6 @@ fi
|
|||
|
||||
dcs_to_kitty() { printf "\033P@kitty-$1|%s\033\134" "$(printf "%s" "$2" | base64_encode)" > /dev/tty; }
|
||||
debug() { dcs_to_kitty "print" "debug: $1"; }
|
||||
echo_via_kitty() { dcs_to_kitty "echo" "$1"; }
|
||||
|
||||
# If $HOME is configured set it here
|
||||
EXPORT_HOME_CMD
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue