fix: connect to stdout fd after starting an ssh shell
this avoids a race condition that would happen if the goroutine tried to read a file descriptor that wasn't open properly and would lose frame delivery
This commit is contained in:
parent
cb32637938
commit
a0a80852eb
@ -120,9 +120,6 @@ func StartWebSSH(agent *tsnet.TSAgent, params SSHConnectPayload) {
|
|||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
// This spawns 2 goroutins for stdout and stderr
|
|
||||||
dispatchSSHStdout(params.SessionId, ctx.Stdout, ctx.Stderr)
|
|
||||||
|
|
||||||
// Spin up a shell and wait for the pty to terminate
|
// Spin up a shell and wait for the pty to terminate
|
||||||
err = sess.Shell()
|
err = sess.Shell()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -131,6 +128,9 @@ func StartWebSSH(agent *tsnet.TSAgent, params SSHConnectPayload) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This spawns 2 goroutins for stdout and stderr
|
||||||
|
dispatchSSHStdout(params.SessionId, ctx.Stdout, ctx.Stderr)
|
||||||
|
|
||||||
log.Info("Opened an SSH PTY for %s", params.SessionId)
|
log.Info("Opened an SSH PTY for %s", params.SessionId)
|
||||||
sess.Wait()
|
sess.Wait()
|
||||||
sess.Close()
|
sess.Close()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user