diff options
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/api/handlers/compat/resize.go | 3 | ||||
-rw-r--r-- | pkg/domain/infra/abi/terminal/terminal.go | 10 | ||||
-rw-r--r-- | pkg/domain/infra/abi/terminal/terminal_linux.go | 5 | ||||
-rw-r--r-- | pkg/kubeutils/resize.go | 4 |
4 files changed, 10 insertions, 12 deletions
diff --git a/pkg/api/handlers/compat/resize.go b/pkg/api/handlers/compat/resize.go index b3c8b7ce4..1bf7ad460 100644 --- a/pkg/api/handlers/compat/resize.go +++ b/pkg/api/handlers/compat/resize.go @@ -11,7 +11,6 @@ import ( "github.com/gorilla/mux" "github.com/gorilla/schema" "github.com/pkg/errors" - "k8s.io/client-go/tools/remotecommand" ) func ResizeTTY(w http.ResponseWriter, r *http.Request) { @@ -32,7 +31,7 @@ func ResizeTTY(w http.ResponseWriter, r *http.Request) { return } - sz := remotecommand.TerminalSize{ + sz := define.TerminalSize{ Width: query.Width, Height: query.Height, } diff --git a/pkg/domain/infra/abi/terminal/terminal.go b/pkg/domain/infra/abi/terminal/terminal.go index 26a692a7f..067c0c08e 100644 --- a/pkg/domain/infra/abi/terminal/terminal.go +++ b/pkg/domain/infra/abi/terminal/terminal.go @@ -5,11 +5,11 @@ import ( "os" "os/signal" + "github.com/containers/podman/v3/libpod/define" lsignal "github.com/containers/podman/v3/pkg/signal" "github.com/moby/term" "github.com/pkg/errors" "github.com/sirupsen/logrus" - "k8s.io/client-go/tools/remotecommand" ) // RawTtyFormatter ... @@ -18,20 +18,20 @@ type RawTtyFormatter struct { // getResize returns a TerminalSize command matching stdin's current // size on success, and nil on errors. -func getResize() *remotecommand.TerminalSize { +func getResize() *define.TerminalSize { winsize, err := term.GetWinsize(os.Stdin.Fd()) if err != nil { logrus.Warnf("Could not get terminal size %v", err) return nil } - return &remotecommand.TerminalSize{ + return &define.TerminalSize{ Width: winsize.Width, Height: winsize.Height, } } // Helper for prepareAttach - set up a goroutine to generate terminal resize events -func resizeTty(ctx context.Context, resize chan remotecommand.TerminalSize) { +func resizeTty(ctx context.Context, resize chan define.TerminalSize) { sigchan := make(chan os.Signal, 1) signal.Notify(sigchan, lsignal.SIGWINCH) go func() { @@ -78,7 +78,7 @@ func (f *RawTtyFormatter) Format(entry *logrus.Entry) ([]byte, error) { return bytes, err } -func handleTerminalAttach(ctx context.Context, resize chan remotecommand.TerminalSize) (context.CancelFunc, *term.State, error) { +func handleTerminalAttach(ctx context.Context, resize chan define.TerminalSize) (context.CancelFunc, *term.State, error) { logrus.Debugf("Handling terminal attach") subCtx, cancel := context.WithCancel(ctx) diff --git a/pkg/domain/infra/abi/terminal/terminal_linux.go b/pkg/domain/infra/abi/terminal/terminal_linux.go index e5036e769..7a0c2907c 100644 --- a/pkg/domain/infra/abi/terminal/terminal_linux.go +++ b/pkg/domain/infra/abi/terminal/terminal_linux.go @@ -11,12 +11,11 @@ import ( "github.com/pkg/errors" "github.com/sirupsen/logrus" "golang.org/x/crypto/ssh/terminal" - "k8s.io/client-go/tools/remotecommand" ) // ExecAttachCtr execs and attaches to a container func ExecAttachCtr(ctx context.Context, ctr *libpod.Container, execConfig *libpod.ExecConfig, streams *define.AttachStreams) (int, error) { - resize := make(chan remotecommand.TerminalSize) + resize := make(chan define.TerminalSize) haveTerminal := terminal.IsTerminal(int(os.Stdin.Fd())) // Check if we are attached to a terminal. If we are, generate resize @@ -41,7 +40,7 @@ func ExecAttachCtr(ctx context.Context, ctr *libpod.Container, execConfig *libpo // if you change the signature of this function from os.File to io.Writer, it will trigger a downstream // error. we may need to just lint disable this one. func StartAttachCtr(ctx context.Context, ctr *libpod.Container, stdout, stderr, stdin *os.File, detachKeys string, sigProxy bool, startContainer bool, recursive bool) error { //nolint-interfacer - resize := make(chan remotecommand.TerminalSize) + resize := make(chan define.TerminalSize) haveTerminal := terminal.IsTerminal(int(os.Stdin.Fd())) diff --git a/pkg/kubeutils/resize.go b/pkg/kubeutils/resize.go index afc697d98..957e10f45 100644 --- a/pkg/kubeutils/resize.go +++ b/pkg/kubeutils/resize.go @@ -17,14 +17,14 @@ limitations under the License. package kubeutils import ( + "github.com/containers/podman/v3/libpod/define" "k8s.io/apimachinery/pkg/util/runtime" - "k8s.io/client-go/tools/remotecommand" ) // HandleResizing spawns a goroutine that processes the resize channel, calling resizeFunc for each // remotecommand.TerminalSize received from the channel. The resize channel must be closed elsewhere to stop the // goroutine. -func HandleResizing(resize <-chan remotecommand.TerminalSize, resizeFunc func(size remotecommand.TerminalSize)) { +func HandleResizing(resize <-chan define.TerminalSize, resizeFunc func(size define.TerminalSize)) { if resize == nil { return } |