Minimal repo case:
use console::Term;
fn main() {
eprintln!("Press any key to exist");
Term::stderr().read_key().unwrap();
}
If this script is compiled and run with a close stdin (cat | target/debug/repro) it will fail with
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 24, kind: Uncategorized, message: "Too many open files" }'
The issue is that read_single_key has a condition where it will call back into itself recursively.
Refs astral-sh/rye#184