-
Notifications
You must be signed in to change notification settings - Fork 285
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
libc::read
syscall can block reading stdin
#692
Comments
I don't think those issues are the same problem, none of them mention the syscall and the unmerged PR doesn't alter the blocking crossterm/src/event/sys/unix/file_descriptor.rs Lines 34 to 39 in f0a7b11
The problem is not the surrounding polling code, its that once The waker Line 64 in f909b3d
Correctly invokes crossterm/src/event/source/unix.rs Line 103 in f909b3d
But it hangs inside of that |
I forgot to like this issue #396 It seems to be the same problem, the gist of it you're having 2 process trying to read from stdin at the same time, this is just known to give unexpected result. You could see here
|
I saw those issues and I do not think they are related. When a parent process creates a child, that child inherits the fds Even if they are separate, |
The following syscall can block waiting for stdin:
crossterm/src/event/sys/unix/file_descriptor.rs
Lines 33 to 37 in 58f580e
Steps to reproduce
Create a new binary project and place the following code in
main.rs
. Once done, run withcargo run
. Wait a few seconds for the loop to emit some text like:Once that has passed, press and release a single key.
Code to reproduce:
Expected behavior
The key is printed to the console
Actual behavior
The key is not printed, and execution stops after printing
Before poll
inside of thelibc::read()
syscall.If we add some logs around the syscall, we can prove that execution gets stuck there:
Performing the steps above, this emits the following to my terminal and hangs:
System Info:
crossterm = "0.24.0"
10.15.7 (19H1922)
The text was updated successfully, but these errors were encountered: