fix(agent): start rpty lifecycle after all reads/writes (#15535)

Fixes https://github.com/coder/internal/issues/214

#15475 missed that we also write to `rpty` after starting
`rpty.lifecycle()`.
This PR moves the function call right at the end. Hopefully this should
address the data races before we go resorting to mutexes.
This commit is contained in:
Cian Johnston
2024-11-15 14:48:17 +00:00
committed by GitHub
parent aca5be5e50
commit 12a9d6336b

View File

@ -78,8 +78,6 @@ func newScreen(ctx context.Context, cmd *pty.Cmd, options *Options, logger slog.
}
rpty.id = hex.EncodeToString(buf)
go rpty.lifecycle(ctx, logger)
settings := []string{
// Disable the startup message that appears for five seconds.
"startup_message off",
@ -124,6 +122,8 @@ func newScreen(ctx context.Context, cmd *pty.Cmd, options *Options, logger slog.
return rpty
}
go rpty.lifecycle(ctx, logger)
return rpty
}