fix: allow retry after ssh auth failure

Previously, the error status was not set when an ssh connection failed.
Because of this, an ssh connection failure would lock the failed remote
until waveterm was rebooted. This fix properly sets the error status so
this cannot happen.
This commit is contained in:
Sylvia Crowe 2024-01-24 20:54:37 -08:00
parent 37821738d8
commit 1547fc856e

View File

@ -1338,13 +1338,17 @@ func (NewLauncher) Launch(msh *MShellProc, interactive bool) {
var client *ssh.Client
client, err = ConnectToClient(remoteCopy.SSHOpts)
if err != nil {
msh.WriteToPtyBuffer("*error, ssh cannot connect to client: %v\n", err)
statusErr := fmt.Errorf("ssh cannot connect to client: %w", err)
msh.WriteToPtyBuffer("*error, %s\n", statusErr.Error())
msh.setErrorStatus(statusErr)
return
}
var session *ssh.Session
session, err = client.NewSession()
if err != nil {
msh.WriteToPtyBuffer("*error, ssh cannot create session: %v\n", err)
statusErr := fmt.Errorf("ssh cannot create session: %w", err)
msh.WriteToPtyBuffer("*error, %s\n", statusErr.Error())
msh.setErrorStatus(statusErr)
return
}
cproc, initPk, err = shexec.MakeClientProc(makeClientCtx, shexec.SessionWrap{Session: session, StartCmd: MakeServerRunOnlyCommandStr()})