mirror of
https://github.com/tale/headplane.git
synced 2026-07-26 07:48:14 +00:00
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:
@@ -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
|
||||
err = sess.Shell()
|
||||
if err != nil {
|
||||
@@ -131,6 +128,9 @@ func StartWebSSH(agent *tsnet.TSAgent, params SSHConnectPayload) {
|
||||
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)
|
||||
sess.Wait()
|
||||
sess.Close()
|
||||
|
||||
Reference in New Issue
Block a user