Skip to content

Allow a script to kill itself without run permissions #8299

@c4spar

Description

@c4spar

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    clirelated to cli/ dirpermissionsrelated to --allow-* flagssuggestionsuggestions for new features (yet to be agreed)

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions