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:
parent
6819c3d7f6
commit
4b83ce8aca
1 changed files with 5 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue