~kennylevinsen/greetd

a7c8ac89cf89cfdaa49fd7ffd900139af82ddc43 — Jonathan Sköld 5 months ago 95ab9cd
agreety: Return error if no input when prompted

If EOF is provided when the user is prompted agreety would panic. This
commit fixes that by returning an error instead causing graceful exit(1)
instead.
1 files changed, 1 insertions(+), 1 deletions(-)

M agreety/src/main.rs
M agreety/src/main.rs => agreety/src/main.rs +1 -1
@@ 22,7 22,7 @@ fn prompt_stderr(prompt: &str) -> Result<String, Box<dyn std::error::Error>> {
    let stdin = io::stdin();
    let mut stdin_iter = stdin.lock().lines();
    eprint!("{}", prompt);
    Ok(stdin_iter.next().unwrap()?)
    Ok(stdin_iter.next().ok_or("no input")??)
}

fn get_distro_name() -> Result<String, Box<dyn std::error::Error>> {