sample code runs into error: operation not supported by device
here is the sample code from document
`// Set stdin in raw mode. oldState, err := term.MakeRaw(int(os.Stdin.Fd())) if err != nil { panic(err) } defer func() { _ = term.Restore(int(os.Stdin.Fd()), oldState) }() // Best effort.
// Copy stdin to the pty and the pty to stdout.
// NOTE: The goroutine will keep reading until the next keystroke before returning.
go func() { _, _ = io.Copy(ptmx, os.Stdin) }()
_, _ = io.Copy(os.Stdout, ptmx)
`
The bold line runs into error, the error mesage is
operation not supported by device
here is the environment
mac os : 14.2.1 go version: 1.21.4 golang.org/x/term v0.16.0
seems it's issue from term, I have raised a bug here https://github.com/golang/go/issues/65095
I couldn't reproduce on osx 14.2.1 with go 1.21.4. Could you provide a more concrete example by any chance?
the reason the test doesn’t wait for the interactive input is the Stdin of the process that’s executed (test binary), is set to the operating system’s null input device (/dev/null on Unix and NUL on Windows). The DevNull device cannot set the raw mode or resize
That makes sense, but then there isn't much we can do, the library requires a valid tty device to work.
Closing for now, feel free to re-open if I missed something.