summaryrefslogtreecommitdiff
path: root/runtime/js
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2022-06-13 23:53:04 +0200
committerGitHub <noreply@github.com>2022-06-13 23:53:04 +0200
commitfc3a966a2d0be8fc76c384603bf18b55e0bbcf14 (patch)
tree2a3425488e0a199c035efbdde35c45cae1c22fb7 /runtime/js
parent4a0a412d7cd077ff519b4da8f6ffd1247c6375a5 (diff)
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.
Diffstat (limited to 'runtime/js')
-rw-r--r--runtime/js/99_main.js6
1 files changed, 5 insertions, 1 deletions
diff --git a/runtime/js/99_main.js b/runtime/js/99_main.js
index ae0de3937..e96482ba2 100644
--- a/runtime/js/99_main.js
+++ b/runtime/js/99_main.js
@@ -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,