-
Notifications
You must be signed in to change notification settings - Fork 119
Breaks with bash redirections #1
Comments
The idea behind sudo-prompt is to prefix a command with "sudo" but show an os dialog if permissions would be necessary. So, sudo-prompt at the moment would take your command above and run:
...but it would also take care of the os prompt along the way. The issue at the moment if I understand correctly is that calling that command using sudo also fails:
The The |
Yup that's it. After some basic testing, If you like I can make a PR? |
Thanks that would be great. |
Does the exit code also propagate? |
I presume so but I haven't tested that, I'll give it a test when I have a few spare minutes. |
Just tried |
Did a bit more testing, this does propagate signals: edit: typo. |
The more I test this, perhaps it's best to leave it out of the lib, unless there's a straightforward way to do it. I'm not familiar enough with the intricacies of bash. |
Thanks for trying, at least the bash -c is documented here for those that need to redirect sudo output. |
Using @davej Zero is the code for successful exists. If you want to "throw" an error you must exit with something different than zero. http://unix.stackexchange.com/questions/15998/what-does-the-e-do-in-a-bash-shebang |
For example, the following bash will give a permissions fail:
It's easily fixed by doing:
Perhaps sudo-prompt should do this (
bash -c
) at the module level instead? String escaping may need a little bit of thought but should be ok.The text was updated successfully, but these errors were encountered: