Closed bendoh closed 8 years ago
Hi @bendoh - thank you for the pull request! Can you confirm that this will function cross *nix?
So this is pretty cross-platform for anything POSIX, since the expression is evaluated by /bin/sh and I made sure that it worked in that context. I have not done any sort of multi-environment matrix testing, however.
On my machine I keep my hosts file writable by wheel so that my regular user account can modify it at a whim without having to inconveniently present my password.
This plugin didn't recognize the writability of that file and thus prompted me for a password unnecessarily.
This change uses the shell to check writability of the file and uses cat to overwrite the file (so permissions stay the same) when it can, otherwise it calls sudo as before.