Panic on reading non-ascii symbols from async_stdin
Created by: aleksander
This minimum example
extern crate termion;
fn main() {
use termion::input::TermRead;
let mut stdin = termion::async_stdin().keys();
loop {
if let Some(Ok(termion::event::Key::Char('q'))) = stdin.next() {
break;
}
}
}
works as expected on input:
echo "q" | RUST_BACKTRACE=1 ./target/debug/async_test
but panics on this:
echo "й" | RUST_BACKTRACE=1 ./target/debug/async_test
Backtrace:
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', ../src/libcore/option.rs:317
stack backtrace:
1: 0x55eef2d60dc3 - std::sys::backtrace::tracing::imp::write::h46f28e67d38b4637
2: 0x55eef2d642cd - std::panicking::default_hook::{{closure}}::h1d3243f546573ff4
3: 0x55eef2d6383a - std::panicking::default_hook::h96c288d728df3ebf
4: 0x55eef2d63e38 - std::panicking::rust_panic_with_hook::hb1322e5f2588b4db
5: 0x55eef2d63cd2 - std::panicking::begin_panic::hfbeda5aad583dc32
6: 0x55eef2d63c10 - std::panicking::begin_panic_fmt::h4fe9fb9d5109c4bf
7: 0x55eef2d63b91 - rust_begin_unwind
8: 0x55eef2d99a2f - core::panicking::panic_fmt::h4395919ece15c671
9: 0x55eef2d9995b - core::panicking::panic::hc74ff52ed78364e1
10: 0x55eef2d34dba - <core::option::Option<T>>::unwrap::h15693cb33eb11843
at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/obj/../src/libcore/macros.rs:21
11: 0x55eef2d437d5 - termion::event::parse_utf8_char::he796d2eaa24dc8c0
at /home/x/.cargo/registry/src/github.com-1ecc6299db9ec823/termion-1.0.8/src/event.rs:283
12: 0x55eef2d4120a - termion::event::parse_event::h6ac22cfa12aeaa31
at /home/x/.cargo/registry/src/github.com-1ecc6299db9ec823/termion-1.0.8/src/event.rs:264
13: 0x55eef2d43f94 - <termion::input::Events<I> as core::iter::iterator::Iterator>::next::h7ff33bf7c94953bc
at /home/x/.cargo/registry/src/github.com-1ecc6299db9ec823/termion-1.0.8/src/input.rs:40
14: 0x55eef2d43a7f - <termion::input::Keys<I> as core::iter::iterator::Iterator>::next::h178cb3a21de07e28
at /home/x/.cargo/registry/src/github.com-1ecc6299db9ec823/termion-1.0.8/src/input.rs:19
15: 0x55eef2d445b4 - async_test::main::h16c6b4cc4e0e7310
at /tmp/async_test/src/main.rs:6
16: 0x55eef2d6bd96 - __rust_maybe_catch_panic
17: 0x55eef2d630b1 - std::rt::lang_start::haaae1186de9de8cb
18: 0x55eef2d44873 - main
19: 0x7feae2be2740 - __libc_start_main
20: 0x55eef2d335d8 - _start
21: 0x0 - <unknown>