diff --git a/src/util.rs b/src/util.rs index d66f5889..d9e7eae5 100644 --- a/src/util.rs +++ b/src/util.rs @@ -134,16 +134,27 @@ pub fn ask(config: &Config, question: &str, default: bool) -> bool { } let stdin = stdin(); let mut input = String::new(); - let _ = stdin.read_line(&mut input); - let input = input.to_lowercase(); - let input = input.trim(); - - if input == tr!("y") || input == tr!("yes") { - true - } else if input.trim().is_empty() { - default - } else { - false + match stdin.read_line(&mut input) { + Ok(0) => { + println!(" -> EOF"); + false + } + Ok(_) => { + let input = input.to_lowercase(); + let input = input.trim(); + + if input == tr!("y") || input == tr!("yes") { + true + } else if input.trim().is_empty() { + default + } else { + false + } + } + Err(_) => { + println!(" -> Error reading input"); + false + } } }