diff --git a/src/cli.rs b/src/cli.rs index 31017ac6aa..b78c44c78f 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -405,6 +405,18 @@ pub async fn cli() -> Result<(), Box> { } LineResult::CtrlC => { + let config_ctrlc_exit = config::config(Tag::unknown())? + .get("ctrlc_exit") + .map(|s| match s.as_string().unwrap().as_ref() { + "true" => true, + _ => false, + }) + .unwrap_or(false); // default behavior is to allow CTRL-C spamming similar to other shells + + if !config_ctrlc_exit { + continue; + } + if ctrlcbreak { let _ = rl.save_history(&History::path()); std::process::exit(0);