fix: wrap the TerminalSizeQueue in an adapter

This fixes an issue with the updated interface dropped in ce4d90902a
This commit is contained in:
Jose Diaz-Gonzalez
2025-12-25 20:58:24 -05:00
parent eb6de2f709
commit f004dafb99

View File

@@ -489,15 +489,34 @@ func (k KubernetesClient) ExecCommand(ctx context.Context, input ExecCommandInpu
}
return exec.StreamWithContext(ctx, remotecommand.StreamOptions{
Stdin: os.Stdin,
Stdout: stdout,
Stderr: stderr,
Tty: actuallyTty,
TerminalSizeQueue: sizeQueue,
Stdin: os.Stdin,
Stdout: stdout,
Stderr: stderr,
Tty: actuallyTty,
TerminalSizeQueue: &terminalSizeQueueAdapter{
delegate: sizeQueue,
},
})
})
}
// terminalSizeQueueAdapter is an adapter for the terminal size queue to the remotecommand.TerminalSizeQueue interface
type terminalSizeQueueAdapter struct {
delegate term.TerminalSizeQueue
}
// Next returns the next terminal size
func (a *terminalSizeQueueAdapter) Next() *remotecommand.TerminalSize {
next := a.delegate.Next()
if next == nil {
return nil
}
return &remotecommand.TerminalSize{
Width: next.Width,
Height: next.Height,
}
}
// GetPodLogsInput contains all the information needed to get the logs for a Kubernetes pod
type GetLogsInput struct {
// Name is the Kubernetes pod name