Skip to content
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

Allow a script to kill itself without run permissions #8299

Open
c4spar opened this issue Nov 8, 2020 · 1 comment
Open

Allow a script to kill itself without run permissions #8299

c4spar opened this issue Nov 8, 2020 · 1 comment
Labels
cli related to cli/ dir permissions related to --allow-* flags suggestion suggestions for new features (yet to be agreed)

Comments

@c4spar
Copy link

c4spar commented Nov 8, 2020

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.

@kitsonk kitsonk added cli related to cli/ dir permissions related to --allow-* flags suggestion suggestions for new features (yet to be agreed) labels Nov 9, 2020
@lino-levan
Copy link
Contributor

Given #16299 recently got merged, I think this would be a really nice thing to have. No need for an argument check anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli related to cli/ dir permissions related to --allow-* flags suggestion suggestions for new features (yet to be agreed)
Projects
None yet
Development

No branches or pull requests

3 participants