diff --git a/go.mod b/go.mod index 7c4ed5d2..db8f7789 100644 --- a/go.mod +++ b/go.mod @@ -5,5 +5,5 @@ go 1.14 require ( github.com/mitchellh/go-ps v1.0.0 github.com/stretchr/testify v1.6.1 - golang.org/x/sys v0.0.0-20200722175500-76b94024e4b6 + golang.org/x/sys v0.0.0-20201015000850-e3ed0017c211 ) diff --git a/go.sum b/go.sum index 383b35b8..bf72da9e 100644 --- a/go.sum +++ b/go.sum @@ -9,6 +9,8 @@ github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= golang.org/x/sys v0.0.0-20200722175500-76b94024e4b6 h1:X9xIZ1YU8bLZA3l6gqDUHSFiD0GFI9S548h6C8nDtOY= golang.org/x/sys v0.0.0-20200722175500-76b94024e4b6/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201015000850-e3ed0017c211 h1:9UQO31fZ+0aKQOFldThf7BKPMJTiBfWycGh/u3UoO88= +golang.org/x/sys v0.0.0-20201015000850-e3ed0017c211/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/go/pty_util_darwin.go b/go/pty_util_darwin.go index 559e865c..1c6d1709 100644 --- a/go/pty_util_darwin.go +++ b/go/pty_util_darwin.go @@ -7,26 +7,23 @@ which is under Apache License Version 2.0, January 2004 */ import ( "os" - "unsafe" "golang.org/x/sys/unix" ) func tcget(fd uintptr, p *unix.Termios) error { - return ioctl(fd, unix.TIOCGETA, uintptr(unsafe.Pointer(p))) -} - -func tcset(fd uintptr, p *unix.Termios) error { - return ioctl(fd, unix.TIOCSETA, uintptr(unsafe.Pointer(p))) -} - -func ioctl(fd, flag, data uintptr) error { - if _, _, err := unix.Syscall(unix.SYS_IOCTL, fd, flag, data); err != 0 { + termios, err := unix.IoctlGetTermios(int(fd), unix.TIOCGETA) + if err != nil { return err } + *p = *termios return nil } +func tcset(fd uintptr, p *unix.Termios) error { + return unix.IoctlSetTermios(int(fd), unix.TIOCSETA, p) +} + func saneTerminal(f *os.File) error { // Go doesn't have a wrapper for any of the termios ioctls. var termios unix.Termios