Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit83ac118

Browse files
committed
Attempt fixing flake with 'echo test' command
1 parent56e71c9 commit83ac118

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

‎agent/reconnectingpty/buffered.go‎

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,16 @@ func (rpty *bufferedReconnectingPTY) Attach(ctx context.Context, connID string,
180180

181181
// Once we are ready, attach the active connection while we hold the mutex.
182182
_,err:=rpty.state.waitForStateOrContext(ctx,StateReady,func(stateState,errerror)error {
183+
// Write any previously stored data for the TTY. Since the command might be
184+
// short-lived and have already exited, make sure we always at least output
185+
// the buffer before returning.
186+
prevBuf:=slices.Clone(rpty.circularBuffer.Bytes())
187+
_,err=conn.Write(prevBuf)
188+
iferr!=nil {
189+
rpty.metrics.WithLabelValues("write").Add(1)
190+
returnxerrors.Errorf("write buffer to conn: %w",err)
191+
}
192+
183193
ifstate!=StateReady {
184194
returnxerrors.Errorf("reconnecting pty ready wait: %w",err)
185195
}
@@ -194,14 +204,7 @@ func (rpty *bufferedReconnectingPTY) Attach(ctx context.Context, connID string,
194204
rpty.metrics.WithLabelValues("resize").Add(1)
195205
}
196206

197-
// Write any previously stored data for the TTY and store the connection for
198-
// future writes.
199-
prevBuf:=slices.Clone(rpty.circularBuffer.Bytes())
200-
_,err=conn.Write(prevBuf)
201-
iferr!=nil {
202-
rpty.metrics.WithLabelValues("write").Add(1)
203-
returnxerrors.Errorf("write buffer to conn: %w",err)
204-
}
207+
// Store the connection for future writes.
205208
rpty.activeConns[connID]=conn
206209

207210
returnnil

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp