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

Commit62f3155

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

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

‎agent/agent.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1038,6 +1038,7 @@ 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
// We don't need to separately monitor for the process exiting.
@@ -1049,6 +1050,8 @@ func (a *agent) handleReconnectingPTY(ctx context.Context, logger slog.Logger, m
10491050
read,err:=rpty.ptty.OutputReader().Read(buffer)
10501051
iferr!=nil {
10511052
// When the PTY is closed, this is triggered.
1053+
// Error is typically a benign EOF, so only log for debugging.
1054+
logger.Debug(ctx,"PTY output read error",slog.Error(err))
10521055
break
10531056
}
10541057
part:=buffer[:read]
@@ -1060,8 +1063,14 @@ func (a *agent) handleReconnectingPTY(ctx context.Context, logger slog.Logger, m
10601063
break
10611064
}
10621065
rpty.activeConnsMutex.Lock()
1063-
for_,conn:=rangerpty.activeConns {
1064-
_,_=conn.Write(part)
1066+
forcid,conn:=rangerpty.activeConns {
1067+
_,err=conn.Write(part)
1068+
logger.Debug(ctx,
1069+
"wrote to active conn",
1070+
slog.F("other_conn_id",cid),
1071+
slog.F("data",part),
1072+
slog.Error(err),
1073+
)
10651074
}
10661075
rpty.activeConnsMutex.Unlock()
10671076
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp