2016-01-28, 01:08
(2016-01-28, 00:08)AvanOsch Wrote: Thanks for a great plugin Ken.
I want to run a command that normally requires "sudo".
How would I go about doing that?
Thanks for your reply!
P.S.
The version I downloaded still had the "debug = True", causing a (pydevd) import error.
-EDIT-
Maybe you could add a check for the files "pycharm-debug.py3k" and "pycharm-debug.egg", so debug gets skipped if those don't exist...
The latest version has the debug error fixed (again).
I don't have a linux environment up and running to test on, but it seems that you need to call a helper .sh script to invoke the actual script.
Based on: http://unix.stackexchange.com/questions/...h-one-sudo
Set your script to run the helper script, passing the actual script file url as an argument
So the helper script would look like:
Code:
sudo "$BASH" -c "$(fc -ln -1)"
You may need to tweak this to get it right. Right now I've been using the git bash on windows for testing .sh and I can't test the whole sudo thing in that context. Perhaps an experienced linux bash person can chime in.
Edit:
The above is for the command line.
I think it would look something like:
Code:
sudo "$BASH" "$@"
Edit 2:
I tested and the above works. ("$*" didn't, "$@" does).
To supply a password:
Code:
#!/usr/bin/env bash
echo mypassword | sudo -S bash "$@"