Skip to content

Commit 7959947

Browse files
committed
Fix panic when using ctrl+c during prompt
1 parent 147c8e1 commit 7959947

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/main.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ fn main() {
100100
// If the program is interrupted while in a dialog the cursor stays hidden. This makes sure
101101
// that the cursor is shown when interrupting the program
102102
ctrlc::set_handler(|| {
103-
dialoguer::console::Term::stdout().show_cursor().unwrap();
103+
let _ = dialoguer::console::Term::stdout().show_cursor();
104104
std::process::exit(1);
105105
})
106106
.unwrap();
@@ -223,15 +223,16 @@ fn main() {
223223
}
224224

225225
// Confirm cleanup if --yes is not present in the args
226-
if !args.yes
227-
&& !dialoguer::Confirm::new()
226+
if !args.yes {
227+
if !dialoguer::Confirm::new()
228228
.with_prompt("Clean the project directories shown above?")
229229
.wait_for_newline(true)
230230
.interact()
231231
.unwrap()
232-
{
233-
println!("Cleanup cancelled");
234-
return;
232+
{
233+
println!("Cleanup cancelled");
234+
return;
235+
}
235236
}
236237

237238
println!("Starting cleanup...");

0 commit comments

Comments
 (0)