mirror of
https://github.com/denoland/deno.git
synced 2024-11-21 15:04:11 -05:00
fix(repl): prevent panic when deleting globalThis.closed property (#24014)
This commit is contained in:
parent
a8c7aec937
commit
290cfb8189
1 changed files with 5 additions and 1 deletions
|
@ -99,6 +99,9 @@ Object.defineProperty(globalThis, "{0}", {{
|
||||||
lastThrownError: undefined,
|
lastThrownError: undefined,
|
||||||
inspectArgs: Deno[Deno.internal].inspectArgs,
|
inspectArgs: Deno[Deno.internal].inspectArgs,
|
||||||
noColor: Deno.noColor,
|
noColor: Deno.noColor,
|
||||||
|
get closed() {{
|
||||||
|
return typeof globalThis.closed === 'undefined' ? false : globalThis.closed;
|
||||||
|
}}
|
||||||
}},
|
}},
|
||||||
}});
|
}});
|
||||||
Object.defineProperty(globalThis, "_", {{
|
Object.defineProperty(globalThis, "_", {{
|
||||||
|
@ -299,8 +302,9 @@ impl ReplSession {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn closing(&mut self) -> Result<bool, AnyError> {
|
pub async fn closing(&mut self) -> Result<bool, AnyError> {
|
||||||
|
let expression = format!(r#"{}.closed"#, *REPL_INTERNALS_NAME);
|
||||||
let closed = self
|
let closed = self
|
||||||
.evaluate_expression("(this.closed)")
|
.evaluate_expression(&expression)
|
||||||
.await?
|
.await?
|
||||||
.result
|
.result
|
||||||
.value
|
.value
|
||||||
|
|
Loading…
Reference in a new issue