use docker's term package instead of ssh terminal

pull/116/head
Dawid Dziurla 5 years ago
parent 5cb1570039
commit 97ddc6820b
No known key found for this signature in database
GPG Key ID: 7B6D8368172E9B0B

@ -37,7 +37,6 @@ require (
github.com/sirupsen/logrus v1.3.0
github.com/spkg/bom v0.0.0-20160624110644-59b7046e48ad
github.com/stretchr/testify v1.2.2
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4 // indirect
golang.org/x/xerrors v0.0.0-20190513163551-3ee3066db522
google.golang.org/grpc v1.22.0 // indirect

@ -4,7 +4,6 @@ import (
"context"
"github.com/docker/docker/api/types/container"
"github.com/docker/docker/pkg/term"
"golang.org/x/crypto/ssh/terminal"
"io"
"os"
@ -372,8 +371,8 @@ func (c *Container) Attach() error {
return err
}
fd := int(os.Stdin.Fd())
oldState, err := terminal.MakeRaw(fd)
fd := os.Stdin.Fd()
oldState, err := term.MakeRaw(fd)
if err != nil {
return err
}
@ -412,7 +411,7 @@ func (c *Container) Attach() error {
return err
}
} else {
err = terminal.Restore(fd, oldState)
err = term.RestoreTerminal(fd, oldState)
if err != nil {
return err
}
@ -423,15 +422,15 @@ func (c *Container) Attach() error {
}
}
func (c *Container) Resize(fd int) error {
width, height, err := terminal.GetSize(fd)
func (c *Container) Resize(fd uintptr) error {
size, err := term.GetWinsize(fd)
if err != nil {
return err
}
options := types.ResizeOptions{
Height: uint(height),
Width: uint(width),
Height: uint(size.Height),
Width: uint(size.Width),
}
err = c.Client.ContainerResize(context.Background(), c.ID, options)

Loading…
Cancel
Save