fix: Add a slightly better error message for dropped SSH connection (#3131)

This commit is contained in:
David Wahler
2022-07-25 10:25:34 -05:00
committed by GitHub
parent f0f0aebdbb
commit 5312296283

View File

@ -2,6 +2,7 @@ package cli
import ( import (
"context" "context"
"errors"
"fmt" "fmt"
"io" "io"
"os" "os"
@ -231,6 +232,11 @@ func ssh() *cobra.Command {
err = sshSession.Wait() err = sshSession.Wait()
if err != nil { if err != nil {
// If the connection drops unexpectedly, we get an ExitMissingError but no other
// error details, so try to at least give the user a better message
if errors.Is(err, &gossh.ExitMissingError{}) {
return xerrors.New("SSH connection ended unexpectedly")
}
return err return err
} }