diff --git a/terminal/runereader_posix.go b/terminal/runereader_posix.go index 3b846049..5957fd91 100644 --- a/terminal/runereader_posix.go +++ b/terminal/runereader_posix.go @@ -44,7 +44,7 @@ func (rr *RuneReader) Buffer() *bytes.Buffer { // For reading runes we just want to disable echo. func (rr *RuneReader) SetTermMode() error { - if _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, uintptr(rr.stdio.In.Fd()), ioctlReadTermios, uintptr(unsafe.Pointer(&rr.state.term)), 0, 0, 0); err != 0 { + if _, _, err := syscall.Syscall(syscall.SYS_IOCTL, uintptr(rr.stdio.In.Fd()), ioctlReadTermios, uintptr(unsafe.Pointer(&rr.state.term))); err != 0 { return err } @@ -56,7 +56,7 @@ func (rr *RuneReader) SetTermMode() error { newState.Cc[syscall.VMIN] = 1 newState.Cc[syscall.VTIME] = 0 - if _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, uintptr(rr.stdio.In.Fd()), ioctlWriteTermios, uintptr(unsafe.Pointer(&newState)), 0, 0, 0); err != 0 { + if _, _, err := syscall.Syscall(syscall.SYS_IOCTL, uintptr(rr.stdio.In.Fd()), ioctlWriteTermios, uintptr(unsafe.Pointer(&newState))); err != 0 { return err } @@ -64,7 +64,7 @@ func (rr *RuneReader) SetTermMode() error { } func (rr *RuneReader) RestoreTermMode() error { - if _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, uintptr(rr.stdio.In.Fd()), ioctlWriteTermios, uintptr(unsafe.Pointer(&rr.state.term)), 0, 0, 0); err != 0 { + if _, _, err := syscall.Syscall(syscall.SYS_IOCTL, uintptr(rr.stdio.In.Fd()), ioctlWriteTermios, uintptr(unsafe.Pointer(&rr.state.term))); err != 0 { return err } return nil diff --git a/terminal/runereader_unix.go b/terminal/runereader_unix.go new file mode 100644 index 00000000..c9f450a1 --- /dev/null +++ b/terminal/runereader_unix.go @@ -0,0 +1,14 @@ +// copied from golang.org/x/term/term_unix_other.go +// Copyright 2021 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build aix || solaris || zos +// +build aix solaris zos + +package terminal + +import "golang.org/x/sys/unix" + +const ioctlReadTermios = unix.TCGETS +const ioctlWriteTermios = unix.TCSETS