You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
`// 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
The text was updated successfully, but these errors were encountered:
kcmvp
changed the title
sample code runs into error
sample code runs into error: operation not supported by device
Jan 13, 2024
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
Uh oh!
There was an error while loading. Please reload this page.
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.
`
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
The text was updated successfully, but these errors were encountered: