rejeep / prodigy.el

Manage external services from within Emacs
GNU General Public License v3.0
550 stars 39 forks source link

sudo issues #111

Open seanfarley opened 6 years ago

seanfarley commented 6 years ago

I just tried out the new :sudo parameter and ran into a few bugs:

  1. since the process is spawned with sudo the usual (signal-process ...) won't be able to kill it without also gaining elevated permissions

  2. for commands that are in the sudoers file with NOPASSWD, prodigy will still prompt for a password and accidentally send that password to the spawned process as input

It seems to me that setting :cwd "/sudo::/" is enough? That will use tramp and not interfere with (2) and will also correctly kill the process which solves (1). Thoughts? I incorrectly tested :cwd, so I don't have a solution yet :-(

ecraven commented 6 years ago

I've run into 1. (not being able to kill those processes). Could you not just run sudo kill ...?

seanfarley commented 6 years ago

Yes, but that requires another prompt to the user. In the case above, I added those command to NOPASSWD and I don't think kill should be in the NOPASSWD field because it's a bit to dangerous.

ecraven commented 6 years ago

Ah, sorry, that should have been obvious. I've now created a systemd unit to do this. Is there any way to use prodigy to just call systemctl start .. and systemctl stop ... instead of actually launching a program?

seanfarley commented 6 years ago

Ah, that's not a bad idea! On my mac, I'd have to use launchctl but yeah, same idea. As for prodigy, it seems some things have to would be tweaked a little to have this "service" idea, I think. Maybe it's possible now but I'm that good with prodigy :-)