Skip to content
This repository was archived by the owner on Apr 19, 2024. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions terminal/runereader_posix.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand All @@ -56,15 +56,15 @@ 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
}

return nil
}

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
Expand Down
14 changes: 14 additions & 0 deletions terminal/runereader_unix.go
Original file line number Diff line number Diff line change
@@ -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