async_stdin do not receive piped output
Created by: aleksander
termion 1.1.1
I don't know actually is this a bug or intented behaviour. Could someone please clarify?
extern crate termion;
fn main() {
use termion::input::TermRead;
let mut stdin = std::io::stdin().keys();
loop {
let s = stdin.next();
if let Some(some) = s {
println!("{:?}", some);
if let Ok(termion::event::Key::Char('q')) = some {
break;
}
}
}
}
I pipe "ABC" to this app with command 'echo "ABC" | app'. It works as expected: echo output piped to my app stdin and input I do from keyboard doesn't have effect.
$ echo "ABC" | RUST_BACKTRACE=1 ./target/debug/tt
Ok(Char('A'))
Ok(Char('B'))
Ok(Char('C'))
Ok(Char('\n'))
But if I change
let mut stdin = std::io::stdin().keys();
to
let mut stdin = termion::async_stdin().keys();
then echo output do not piped to my app, but my app gets input from keyboard. Why is that so?