Reliable pattern for cleaning up resources as process exists?
I'm using Explicit Resource Management (
I'm familiar with (never mind, unload doesn't fire during SIGINT)
I also know about
await using resource = ...), but [Symbol.asyncDispose] doesn't get called if my program is killed with SIGINT or other signals. Is there a known/good pattern for making sure some resource gets cleaned up, even if the process is dying?window.onunload, but since that's a global, it feels unreliable to rely on, since anything else in my dependencies might overwrite it during a lengthy runtime. I may also have more than one thing that I want to clean up.I also know about
Deno.addSignalListener() but there are an awful lot of signals I'd need to listen to.