diff --git a/cli/tools/repl.rs b/cli/tools/repl.rs index cd28391155..c610d7e669 100644 --- a/cli/tools/repl.rs +++ b/cli/tools/repl.rs @@ -449,7 +449,7 @@ pub async fn run( inject_prelude(&mut worker, &mut session, context_id).await?; - while !is_closing(&mut worker, &mut session, context_id).await? { + loop { let line = read_line_and_poll( &mut worker, &mut session, @@ -504,6 +504,12 @@ pub async fn run( evaluate_response }; + // We check for close and break here instead of making it a loop condition to get + // consistent behavior in when the user evaluates a call to close(). + if is_closing(&mut worker, &mut session, context_id).await? { + break; + } + let evaluate_result = evaluate_response.get("result").unwrap(); let evaluate_exception_details = evaluate_response.get("exceptionDetails");