creack / pty

PTY interface for Go
https://pkg.go.dev/github.com/creack/pty?tab=doc
MIT License
1.68k stars 234 forks source link

SetReadDeadline is invalid for pty read, it will block #174

Closed itmisx closed 10 months ago

creack commented 11 months ago

Would you have more details? context? way to reproduce?

itmisx commented 11 months ago

eg

ptmx.SetReadDeadline(time.Now().Add(time.Second))
ptmx.Read(buf)

i set the read deadline one second, but if there is no new msg, the read will always block

creack commented 11 months ago

On what go version, what os/arch?

creack commented 10 months ago

Note that v1.1.21 reverted the non-block behavior introduced by #167, all os are now blocking, which mean SetReadDeadline will not work.

While there is nothing we can do about windows, if you believe it is really important, maybe we could add an optional flag or a different public method to use non-block on OSX and Linux.

Closing for now as it is an expected behavior.