mirror of
https://github.com/creack/pty.git
synced 2026-04-01 19:09:48 +09:00
(*os.File).Fd() implicitly sets file descriptor into blocking mode [1], [2] We avoid that by calling (*os.File).SyscallConn instead. This method was added in go1.12 (released on 2019-02-25) [1]: https://pkg.go.dev/os#File.Fd [2]: https://cs.opensource.google/go/go/+/refs/tags/go1.20.3:src/os/file_unix.go;l=80-87
20 lines
331 B
Go
20 lines
331 B
Go
//go:build !windows && !solaris && !aix
|
|
// +build !windows,!solaris,!aix
|
|
|
|
package pty
|
|
|
|
import "syscall"
|
|
|
|
const (
|
|
TIOCGWINSZ = syscall.TIOCGWINSZ
|
|
TIOCSWINSZ = syscall.TIOCSWINSZ
|
|
)
|
|
|
|
func ioctl_inner(fd, cmd, ptr uintptr) error {
|
|
_, _, e := syscall.Syscall(syscall.SYS_IOCTL, fd, cmd, ptr)
|
|
if e != 0 {
|
|
return e
|
|
}
|
|
return nil
|
|
}
|