From 45ad1d81b9140ec1add3c9d65d6b8b5c11a8dcb5 Mon Sep 17 00:00:00 2001 From: Cyborus Date: Sat, 13 Jul 2024 23:04:04 -0400 Subject: [PATCH] fix: print message before reading in `readline` --- src/main.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index e330f53..59a70da 100644 --- a/src/main.rs +++ b/src/main.rs @@ -136,8 +136,9 @@ async fn update_msg(check: bool) -> eyre::Result<()> { } async fn readline(msg: &str) -> eyre::Result { + use std::io::Write; print!("{msg}"); - tokio::io::stdout().flush().await?; + std::io::stdout().flush()?; tokio::task::spawn_blocking(|| { let mut input = String::new(); std::io::stdin().read_line(&mut input)?;