Skip to content

Commit ad7e518

Browse files
johnstcnpull[bot]
authored andcommitted
fix(agent): start rpty lifecycle after all reads/writes (#15535)
Fixes coder/internal#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.
1 parent 35fa21e commit ad7e518

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

agent/reconnectingpty/screen.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,6 @@ func newScreen(ctx context.Context, cmd *pty.Cmd, options *Options, logger slog.
7878
}
7979
rpty.id = hex.EncodeToString(buf)
8080

81-
go rpty.lifecycle(ctx, logger)
82-
8381
settings := []string{
8482
// Disable the startup message that appears for five seconds.
8583
"startup_message off",
@@ -124,6 +122,8 @@ func newScreen(ctx context.Context, cmd *pty.Cmd, options *Options, logger slog.
124122
return rpty
125123
}
126124

125+
go rpty.lifecycle(ctx, logger)
126+
127127
return rpty
128128
}
129129

0 commit comments

Comments
 (0)