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

If hosts file is writable without sudo, don't use sudo #194

Merged
merged 1 commit into from
Jun 16, 2016

Conversation

bendoh
Copy link
Contributor

@bendoh bendoh commented Jun 3, 2016

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.

@seth-reeser
Copy link
Member

Hi @bendoh - thank you for the pull request! Can you confirm that this will function cross *nix?

@bendoh
Copy link
Contributor Author

bendoh commented Jun 3, 2016

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.

@seth-reeser seth-reeser merged commit 5597482 into devopsgroup-io:master Jun 16, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants