mirror of
https://github.com/coder/coder.git
synced 2025-07-13 21:36:50 +00:00
fix: Add a slightly better error message for dropped SSH connection (#3131)
This commit is contained in:
@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user