Raise a signal on the current process #9093
Labels
permissions
related to --allow-* flags
public API
related to "Deno" namespace in JS
runtime
Relates to code in the runtime crate
suggestion
suggestions for new features (yet to be agreed)
A common pattern with signals like SIGHUP, SIGINT, and SIGTERM is to perform some cleanup and then invoke the default handler. For example, in C:
This is different from calling
exit
yourself. For one thing,exit
is not async-signal-safe, so you'd actually need to call_exit
orabort
. But more importantly, the parent process (e.g. the shell) can tell fromwait
if a child was killed by a signal or exited normally. So even if you mimic the exit code:it will not be the same as invoking the default handler.
You can call
Deno.kill(Deno.pid, sig)
, but this requires the very broad permission--allow-run
. It would be better if there was aDeno.raise(sig)
function that did not require any permission.The text was updated successfully, but these errors were encountered: