mirror of
https://github.com/denoland/deno.git
synced 2025-08-02 18:12:39 +00:00
Deno.exit() is an alias to self.close() in worker contexts (#14826)
This commit changes Deno.exit() to be an alias to self.close() in worker contexts, and the provided exit code becomes is ignored.
This commit is contained in:
parent
4a0a412d7c
commit
fc3a966a2d
11 changed files with 66 additions and 47 deletions
|
@ -581,7 +581,6 @@ delete Object.prototype.__proto__;
|
|||
defineEventHandler(window, "error");
|
||||
defineEventHandler(window, "load");
|
||||
defineEventHandler(window, "unload");
|
||||
|
||||
const isUnloadDispatched = SymbolFor("isUnloadDispatched");
|
||||
// Stores the flag for checking whether unload is dispatched or not.
|
||||
// This prevents the recursive dispatches of unload events.
|
||||
|
@ -682,6 +681,11 @@ delete Object.prototype.__proto__;
|
|||
|
||||
defineEventHandler(self, "message");
|
||||
defineEventHandler(self, "error", undefined, true);
|
||||
// `Deno.exit()` is an alias to `self.close()`. Setting and exit
|
||||
// code using an op in worker context is a no-op.
|
||||
os.setExitHandler((_exitCode) => {
|
||||
workerClose();
|
||||
});
|
||||
|
||||
runtimeStart(
|
||||
runtimeOptions,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue