I’m writing a text editor that uses a raw TTY for user input. I’m also using tokio to process this input in an asynchronous manner. However, I’ve noticed that setting stdin nonblocking also sets stdout to be nonblocking.
How can I set only stdin to be nonblocking in Rust in a semi-portable way (MacOS and Linux)? It seems like I need to open a separate file descriptor for stdin and stdout, and then
O_NONBLOCK on the new descriptor, but I’m not sure how best to do that.