Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5312296

Browse files
authored
fix: Add a slightly better error message for dropped SSH connection (#3131)
1 parent f0f0aeb commit 5312296

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

cli/ssh.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package cli
22

33
import (
44
"context"
5+
"errors"
56
"fmt"
67
"io"
78
"os"
@@ -231,6 +232,11 @@ func ssh() *cobra.Command {
231232

232233
err = sshSession.Wait()
233234
if err != nil {
235+
// If the connection drops unexpectedly, we get an ExitMissingError but no other
236+
// error details, so try to at least give the user a better message
237+
if errors.Is(err, &gossh.ExitMissingError{}) {
238+
return xerrors.New("SSH connection ended unexpectedly")
239+
}
234240
return err
235241
}
236242

0 commit comments

Comments
 (0)