From 050a71a5025629526389ab068049b3bbe8d1665f Mon Sep 17 00:00:00 2001 From: iff Date: Tue, 7 Jan 2025 11:47:16 +0100 Subject: [PATCH] fix: interrupt inquire to exit --- CHANGELOG.md | 4 ++++ core/src/modes.rs | 2 +- core/src/suggestions.rs | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 43f1e4d..ad5cdf4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Fixed + +- No longer panics when interrupting multi-suggest + ## [0.6.10] - 2025-01-07 ### Fixed diff --git a/core/src/modes.rs b/core/src/modes.rs index e957319..95ee5e2 100644 --- a/core/src/modes.rs +++ b/core/src/modes.rs @@ -155,7 +155,7 @@ pub fn cnf(data: &mut Data) { .with_render_config(render_config) .without_filtering() .prompt() - .unwrap(); + .unwrap_or_else(|_| std::process::exit(1)); // retry after installing package if system::install_package(data, &package_manager, &package) { diff --git a/core/src/suggestions.rs b/core/src/suggestions.rs index bbd2bfb..effbe19 100644 --- a/core/src/suggestions.rs +++ b/core/src/suggestions.rs @@ -131,7 +131,7 @@ pub fn select_candidate(data: &mut Data) { .without_help_message() .with_render_config(render_config) .prompt() - .unwrap(); + .unwrap_or_else(|_| exit(1)); let pos = highlight_candidates.iter().position(|x| x == &ans).unwrap(); let suggestion = candidates[pos].to_string(); data.update_suggest(&suggestion);