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

Commit620a57e

Browse files
committed
More reconnectingPTY logging
Signed-off-by: Spike Curtis <spike@coder.com>
1 parente8f0826 commit620a57e

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

‎agent/agent.go

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1038,12 +1038,14 @@ func (a *agent) handleReconnectingPTY(ctx context.Context, logger slog.Logger, m
10381038
// 1. The timeout completed.
10391039
// 2. The parent context was canceled.
10401040
<-ctx.Done()
1041+
logger.Debug(ctx,"context done",slog.Error(ctx.Err()))
10411042
_=process.Kill()
10421043
}()
10431044
gofunc() {
10441045
// If the process dies randomly, we should
10451046
// close the pty.
1046-
_=process.Wait()
1047+
err:=process.Wait()
1048+
logger.Debug(ctx,"process exited",slog.Error(err))
10471049
rpty.Close()
10481050
}()
10491051
iferr=a.trackConnGoroutine(func() {
@@ -1052,6 +1054,8 @@ func (a *agent) handleReconnectingPTY(ctx context.Context, logger slog.Logger, m
10521054
read,err:=rpty.ptty.OutputReader().Read(buffer)
10531055
iferr!=nil {
10541056
// When the PTY is closed, this is triggered.
1057+
// Error is typically a benign EOF, so only log for debugging.
1058+
logger.Debug(ctx,"PTY output read error",slog.Error(err))
10551059
break
10561060
}
10571061
part:=buffer[:read]
@@ -1063,8 +1067,14 @@ func (a *agent) handleReconnectingPTY(ctx context.Context, logger slog.Logger, m
10631067
break
10641068
}
10651069
rpty.activeConnsMutex.Lock()
1066-
for_,conn:=rangerpty.activeConns {
1067-
_,_=conn.Write(part)
1070+
forcid,conn:=rangerpty.activeConns {
1071+
_,err=conn.Write(part)
1072+
logger.Debug(ctx,
1073+
"wrote to active conn",
1074+
slog.F("other_conn_id",cid),
1075+
slog.F("data",part),
1076+
slog.Error(err),
1077+
)
10681078
}
10691079
rpty.activeConnsMutex.Unlock()
10701080
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp