diff options
author | Casper Beyer <caspervonb@pm.me> | 2020-12-01 21:13:30 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-01 14:13:30 +0100 |
commit | 5560a6d589ea3414d01b684b59769625c3576e8a (patch) | |
tree | 03497ba311b07bdc1e346d68dc3b79276aa0ebbe | |
parent | 53fa45eb73774bf4a7bd04ef4eb1ac59fd3e0dd7 (diff) |
fix(repl): close calls sometimes prints results (#8558)
-rw-r--r-- | cli/tools/repl.rs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/cli/tools/repl.rs b/cli/tools/repl.rs index cd2839115..c610d7e66 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"); |