@@ -52,8 +52,6 @@ func newBuffered(ctx context.Context, cmd *pty.Cmd, options *Options, logger slo
52
52
timeout : options .Timeout ,
53
53
}
54
54
55
- go rpty .lifecycle (ctx , logger )
56
-
57
55
// Default to buffer 64KiB.
58
56
circularBuffer , err := circbuf .NewBuffer (64 << 10 )
59
57
if err != nil {
@@ -75,6 +73,8 @@ func newBuffered(ctx context.Context, cmd *pty.Cmd, options *Options, logger slo
75
73
rpty .ptty = ptty
76
74
rpty .process = process
77
75
76
+ go rpty .lifecycle (ctx , logger )
77
+
78
78
// Multiplex the output onto the circular buffer and each active connection.
79
79
// We do not need to separately monitor for the process exiting. When it
80
80
// exits, our ptty.OutputReader() will return EOF after reading all process
@@ -125,7 +125,7 @@ func newBuffered(ctx context.Context, cmd *pty.Cmd, options *Options, logger slo
125
125
}
126
126
127
127
// lifecycle manages the lifecycle of the reconnecting pty. If the context ends
128
- // the reconnecting pty will be closed.
128
+ // the reconnecting pty and every connection will be closed.
129
129
func (rpty * bufferedReconnectingPTY ) lifecycle (ctx context.Context , logger slog.Logger ) {
130
130
rpty .timer = time .AfterFunc (attachTimeout , func () {
131
131
rpty .Close ("reconnecting pty timeout" )
0 commit comments