fix: wrap the TerminalSizeQueue in an adapter
This fixes an issue with the updated interface dropped in ce4d90902a
This commit is contained in:
@@ -489,15 +489,34 @@ func (k KubernetesClient) ExecCommand(ctx context.Context, input ExecCommandInpu
|
|||||||
}
|
}
|
||||||
|
|
||||||
return exec.StreamWithContext(ctx, remotecommand.StreamOptions{
|
return exec.StreamWithContext(ctx, remotecommand.StreamOptions{
|
||||||
Stdin: os.Stdin,
|
Stdin: os.Stdin,
|
||||||
Stdout: stdout,
|
Stdout: stdout,
|
||||||
Stderr: stderr,
|
Stderr: stderr,
|
||||||
Tty: actuallyTty,
|
Tty: actuallyTty,
|
||||||
TerminalSizeQueue: sizeQueue,
|
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
|
// GetPodLogsInput contains all the information needed to get the logs for a Kubernetes pod
|
||||||
type GetLogsInput struct {
|
type GetLogsInput struct {
|
||||||
// Name is the Kubernetes pod name
|
// Name is the Kubernetes pod name
|
||||||
|
|||||||
Reference in New Issue
Block a user