Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
itmisx opened this issue Nov 4, 2023 · 4 comments
Closed

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

itmisx opened this issue Nov 4, 2023 · 4 comments

Comments

@itmisx
Copy link

itmisx commented Nov 4, 2023

No description provided.

@creack
Copy link
Owner

creack commented Nov 4, 2023

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

@itmisx
Copy link
Author

itmisx commented Nov 9, 2023

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
Copy link
Owner

creack commented Nov 9, 2023

On what go version, what os/arch?

@creack
Copy link
Owner

creack commented Nov 16, 2023

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

  • On windows, non-block is not supported for the console.
  • On OSX, non-block causes the read to use 100% CPU.
  • On Linux, non-block causes races resulting in random silent failures of ioctl, read and write.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants