-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Description
If this has already been discussed in another issue I'm sorry, I haven't found one.
I'am working on cliffy and we are trying to improve the sigint handling of the prompt module, if a user hit's ctrl+c
. The problem is, deno doesn't trigger the sigint signal automaticly, because we need to enable the raw mode with Deno.setRaw
.
Currently, the prompt module just exits if the user hit's ctrl+c
by calling Deno.exit
. But instead of just exiting the programm, we want to use the Deno.kill
method to rise a sigint, so it's possible to run some cleanup operations if the user hit's ctrl+c
.
But currently it's not possible to rise a signal without the --allow-run
permissions flag. And i don't want the prompt module to depend on the --allow-run
flag.
One option to improve this could be to allow a script to kill itself without the --allow-run
flag. This could be done by checking the pid of the running script. If the pid passed to Deno.kill
matches the pid of the running script, the --allow-run
flag is not required.