main.rs: Fix the "Goodbye"

Add a condition to let the key-watching loop stop

Signed-off-by: Konrad Dybcio <konradybcio@kernel.org>
This commit is contained in:
Konrad Dybcio
2024-04-30 11:18:13 +02:00
committed by Konrad Dybcio
parent d02d6b5ef1
commit 67fe7d0cd5

View File

@@ -96,7 +96,7 @@ async fn main() {
let stdin_handler = tokio::spawn(async move {
let mut stdin = os_pipe::dup_stdin().expect("Couldn't dup stdin");
loop {
while !*quit2.lock().await {
if stdin.read(&mut key_buf).unwrap() > 0 {
handle_keypress(key_buf[0] as char, &mut quit2).await;
};