From d79f30e8971c2de5da0b9d997568a5f3c8930135 Mon Sep 17 00:00:00 2001 From: Jiahao XU Date: Sun, 19 Jun 2022 18:41:48 +1000 Subject: [PATCH] Treat failure to read input as `UserAbort` Signed-off-by: Jiahao XU --- src/helpers/ui_thread.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/helpers/ui_thread.rs b/src/helpers/ui_thread.rs index d1ba7fc6..879e5d5f 100644 --- a/src/helpers/ui_thread.rs +++ b/src/helpers/ui_thread.rs @@ -52,7 +52,9 @@ impl UIThreadInner { stdout.flush().unwrap(); input.clear(); - stdin.read_line(&mut input).unwrap(); + if stdin.read_line(&mut input).is_err() { + break Err(BinstallError::UserAbort); + } match input.as_str().trim() { "yes" | "y" | "YES" | "Y" => break Ok(()),