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

fix(repl): prevent panic when deleting globalThis.closed property (#24014)

This commit is contained in:
safaa-mojahed 2024-06-18 04:34:25 +03:00 committed by GitHub
parent 6819c3d7f6
commit 4b83ce8aca
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -99,6 +99,9 @@ Object.defineProperty(globalThis, "{0}", {{
lastThrownError: undefined,
inspectArgs: Deno[Deno.internal].inspectArgs,
noColor: Deno.noColor,
get closed() {{
return typeof globalThis.closed === 'undefined' ? false : globalThis.closed;
}}
}},
}});
Object.defineProperty(globalThis, "_", {{
@ -299,8 +302,9 @@ impl ReplSession {
}
pub async fn closing(&mut self) -> Result<bool, AnyError> {
let expression = format!(r#"{}.closed"#, *REPL_INTERNALS_NAME);
let closed = self
.evaluate_expression("(this.closed)")
.evaluate_expression(&expression)
.await?
.result
.value