1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-22 23:34:47 -05:00

fix(repl): close calls sometimes prints results (#8558)

This commit is contained in:
Casper Beyer 2020-12-01 21:13:30 +08:00 committed by GitHub
parent 53fa45eb73
commit 5560a6d589
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -449,7 +449,7 @@ pub async fn run(
inject_prelude(&mut worker, &mut session, context_id).await?; 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( let line = read_line_and_poll(
&mut worker, &mut worker,
&mut session, &mut session,
@ -504,6 +504,12 @@ pub async fn run(
evaluate_response 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_result = evaluate_response.get("result").unwrap();
let evaluate_exception_details = let evaluate_exception_details =
evaluate_response.get("exceptionDetails"); evaluate_response.get("exceptionDetails");