@@ -25,6 +25,7 @@ import (
25
25
26
26
// screenReconnectingPTY provides a reconnectable PTY via `screen`.
27
27
type screenReconnectingPTY struct {
28
+ logger slog.Logger
28
29
execer agentexec.Execer
29
30
command * pty.Cmd
30
31
@@ -62,6 +63,7 @@ type screenReconnectingPTY struct {
62
63
// own which causes it to spawn with the specified size.
63
64
func newScreen (ctx context.Context ,logger slog.Logger ,execer agentexec.Execer ,cmd * pty.Cmd ,options * Options )* screenReconnectingPTY {
64
65
rpty := & screenReconnectingPTY {
66
+ logger :logger ,
65
67
execer :execer ,
66
68
command :cmd ,
67
69
metrics :options .Metrics ,
@@ -173,6 +175,7 @@ func (rpty *screenReconnectingPTY) Attach(ctx context.Context, _ string, conn ne
173
175
174
176
ptty ,process ,err := rpty .doAttach (ctx ,conn ,height ,width ,logger )
175
177
if err != nil {
178
+ logger .Debug (ctx ,"unable to attach to screen reconnecting pty" ,slog .Error (err ))
176
179
if errors .Is (err ,context .Canceled ) {
177
180
// Likely the process was too short-lived and canceled the version command.
178
181
// TODO: Is it worth distinguishing between that and a cancel from the
@@ -182,6 +185,7 @@ func (rpty *screenReconnectingPTY) Attach(ctx context.Context, _ string, conn ne
182
185
}
183
186
return err
184
187
}
188
+ logger .Debug (ctx ,"attached to screen reconnecting pty" )
185
189
186
190
defer func () {
187
191
// Log only for debugging since the process might have already exited on its
@@ -403,6 +407,7 @@ func (rpty *screenReconnectingPTY) Wait() {
403
407
}
404
408
405
409
func (rpty * screenReconnectingPTY )Close (err error ) {
410
+ rpty .logger .Debug (context .Background (),"closing screen reconnecting pty" ,slog .Error (err ))
406
411
// The closing state change will be handled by the lifecycle.
407
412
rpty .state .setState (StateClosing ,err )
408
413
}