-
Notifications
You must be signed in to change notification settings - Fork 5.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clean up on Deno.exit() #3603
Comments
IMO we should treat these 3 scenarios as different "emergency exits", and they each might have independent implications. It might be better to treat them independently:
|
Related: it'd be nice to configurably change exit's behavior to throw. |
This causes |
Can confirm this is still an issue. Not sure where in the code to look yet as far as what can be done to fix. Similar pattern on Node "just works": process.on('exit', () => console.log('Hello, world!'))
process.exit() // Console outputs "Hello, world!". Equivalent in Deno just does... nothing? window.onunload = () => console.log('Hello, world!')
Deno.exit() // Nothing to see here, move along... EDIT: try {
window.dispatchEvent(new Event('unload'))
} catch (error) {}
Deno.exit(1) Does not take care of anything unintended by a library author or signal interrupts from the user/os. But it's a workaround. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
window.onunload
andwindow.addEventListener "unload"
work fine for when a script normally ends. But whenDeno.exit()
is calledit seems, there is no way to do any clean up action. Is this intended?
Thanks and much love to all contributors.
The text was updated successfully, but these errors were encountered: