summaryrefslogtreecommitdiff
path: root/cli/tools/repl/mod.rs
diff options
context:
space:
mode:
authorsigmaSd <bedisnbiba@gmail.com>2022-12-17 00:39:52 +0100
committerGitHub <noreply@github.com>2022-12-16 18:39:52 -0500
commitc39550fe522306d049716a0c6aca5a850c841f7e (patch)
tree5fd880572d90cb245afd2333129aec875be5591e /cli/tools/repl/mod.rs
parentefcb93f8b9610bff896f21ecb5add7d17de40156 (diff)
fix(repl): doing two history searches exiting with ctrl+c should not exit repl (#17079)
fix https://github.com/denoland/deno/issues/16147
Diffstat (limited to 'cli/tools/repl/mod.rs')
-rw-r--r--cli/tools/repl/mod.rs7
1 files changed, 3 insertions, 4 deletions
diff --git a/cli/tools/repl/mod.rs b/cli/tools/repl/mod.rs
index 8fcae505e..b59405580 100644
--- a/cli/tools/repl/mod.rs
+++ b/cli/tools/repl/mod.rs
@@ -91,7 +91,6 @@ pub async fn run(flags: Flags, repl_flags: ReplFlags) -> Result<i32, AnyError> {
let worker = worker.into_main_worker();
let mut repl_session = ReplSession::initialize(ps.clone(), worker).await?;
let mut rustyline_channel = rustyline_channel();
- let mut should_exit_on_interrupt = false;
let helper = EditorHelper {
context_id: repl_session.context_id,
@@ -154,7 +153,7 @@ pub async fn run(flags: Flags, repl_flags: ReplFlags) -> Result<i32, AnyError> {
.await;
match line {
Ok(line) => {
- should_exit_on_interrupt = false;
+ editor.set_should_exit_on_interrupt(false);
editor.update_history(line.clone());
let output = repl_session.evaluate_line_and_get_output(&line).await;
@@ -167,10 +166,10 @@ pub async fn run(flags: Flags, repl_flags: ReplFlags) -> Result<i32, AnyError> {
println!("{}", output);
}
Err(ReadlineError::Interrupted) => {
- if should_exit_on_interrupt {
+ if editor.should_exit_on_interrupt() {
break;
}
- should_exit_on_interrupt = true;
+ editor.set_should_exit_on_interrupt(true);
println!("press ctrl+c again to exit");
continue;
}