Merge pull request 'print message before reading in readline' (#92) from readline-fix into main

Reviewed-on: https://codeberg.org/Cyborus/forgejo-cli/pulls/92
This commit is contained in:
Cyborus 2024-07-14 03:08:35 +00:00
commit 4a9c9b7301

View file

@ -136,8 +136,9 @@ async fn update_msg(check: bool) -> eyre::Result<()> {
}
async fn readline(msg: &str) -> eyre::Result<String> {
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)?;