From c48e05e6c9499c6c032c6b4a0d0e615290dc4e80 Mon Sep 17 00:00:00 2001 From: Arran Walker <ajwalker@gitlab.com> Date: Tue, 26 Sep 2023 23:23:17 +0100 Subject: [PATCH] Migrate from docker/pkg/term to golang.org/x/term --- libmachine/ssh/client.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libmachine/ssh/client.go b/libmachine/ssh/client.go index 780b11a5..cf956312 100644 --- a/libmachine/ssh/client.go +++ b/libmachine/ssh/client.go @@ -11,11 +11,11 @@ import ( "strconv" "strings" - "github.com/docker/docker/pkg/term" "github.com/docker/machine/libmachine/log" "github.com/docker/machine/libmachine/mcnutils" "golang.org/x/crypto/ssh" "golang.org/x/crypto/ssh/terminal" + "golang.org/x/term" ) type Client interface { @@ -293,7 +293,7 @@ func (client *NativeClient) Shell(args ...string) error { ssh.ECHO: 1, } - fd := os.Stdin.Fd() + fd := int(os.Stdin.Fd()) if term.IsTerminal(fd) { oldState, err := term.MakeRaw(fd) @@ -301,15 +301,15 @@ func (client *NativeClient) Shell(args ...string) error { return err } - defer term.RestoreTerminal(fd, oldState) + defer term.Restore(fd, oldState) - winsize, err := term.GetWinsize(fd) + width, height, err := term.GetSize(fd) if err != nil { termWidth = 80 termHeight = 24 } else { - termWidth = int(winsize.Width) - termHeight = int(winsize.Height) + termWidth = width + termHeight = height } } -- GitLab