mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-23 16:58:09 +02:00
ssh kitten: Fix a regression in 0.28.0 that caused interrupt during setup to not be handled gracefully
Fixes #6254
This commit is contained in:
@@ -16,6 +16,7 @@ import (
|
||||
"net/url"
|
||||
"os"
|
||||
"os/exec"
|
||||
"os/signal"
|
||||
"os/user"
|
||||
"path"
|
||||
"path/filepath"
|
||||
@@ -669,6 +670,9 @@ func run_ssh(ssh_args, server_args, found_extra_args []string) (rc int, err erro
|
||||
if err != nil {
|
||||
return 1, err
|
||||
}
|
||||
sigs := make(chan os.Signal, 8)
|
||||
signal.Notify(sigs, unix.SIGINT, unix.SIGTERM)
|
||||
|
||||
if !cd.request_data {
|
||||
rq := fmt.Sprintf("id=%s:pwfile=%s:pw=%s", cd.replacements["REQUEST_ID"], cd.replacements["PASSWORD_FILENAME"], cd.replacements["DATA_PASSWORD"])
|
||||
err := term.ApplyOperations(tty.TCSANOW, tty.SetNoEcho)
|
||||
@@ -685,6 +689,11 @@ func run_ssh(ssh_args, server_args, found_extra_args []string) (rc int, err erro
|
||||
return 1, err
|
||||
}
|
||||
}
|
||||
go func() {
|
||||
_ = <-sigs
|
||||
// ignore any interrupt and terminate signals as they will usually be sent to the ssh child process as well
|
||||
// and we are waiting on that.
|
||||
}()
|
||||
err = c.Wait()
|
||||
drain_potential_tty_garbage(term)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user