diff --git a/io_test.go b/io_test.go index f68956c..57fbd3d 100644 --- a/io_test.go +++ b/io_test.go @@ -1,3 +1,6 @@ +//go:build go1.12 +// +build go1.12 + package pty import ( diff --git a/ioctl.go b/ioctl.go index 4e26755..60ac9b8 100644 --- a/ioctl.go +++ b/ioctl.go @@ -1,7 +1,6 @@ -//go:build !windows -// +build !windows +//go:build !windows && go1.12 +// +build !windows,go1.12 -// package pty import "os" diff --git a/ioctl_legacy.go b/ioctl_legacy.go new file mode 100644 index 0000000..f00b1a1 --- /dev/null +++ b/ioctl_legacy.go @@ -0,0 +1,10 @@ +//go:build !windows && !go1.12 +// +build !windows,!go1.12 + +package pty + +import "os" + +func ioctl(f *os.File, cmd, ptr uintptr) error { + return ioctl_inner(f.Fd(), cmd, ptr) // fall back to blocking io (old behavior) +}