mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
Reconnecting PTY waits for command output or EOF (#7279)
Signed-off-by: Spike Curtis <spike@coder.com>
This commit is contained in:
+3
-6
@@ -1036,12 +1036,9 @@ func (a *agent) handleReconnectingPTY(ctx context.Context, logger slog.Logger, m
|
||||
<-ctx.Done()
|
||||
_ = process.Kill()
|
||||
}()
|
||||
go func() {
|
||||
// If the process dies randomly, we should
|
||||
// close the pty.
|
||||
_ = process.Wait()
|
||||
rpty.Close()
|
||||
}()
|
||||
// We don't need to separately monitor for the process exiting.
|
||||
// When it exits, our ptty.OutputReader() will return EOF after
|
||||
// reading all process output.
|
||||
if err = a.trackConnGoroutine(func() {
|
||||
buffer := make([]byte, 1024)
|
||||
for {
|
||||
|
||||
Reference in New Issue
Block a user