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

Add checks: if config file exists and is writeable #2

Merged
merged 2 commits into from
Nov 21, 2013

Conversation

malthejorgensen
Copy link
Contributor

When running wd I got errors that .warprc didn't exist so I added a check that creates the file in case it doesn't exist, and stops the program if .warprc isn't writeable.

if [[ ! -w $CONFIG ]]
then
wd_print_msg $RED "\'$CONFIG\' is not writeable. Exiting."
exit 1
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution! Had completely forgotten about that.

Though, the commented line will be a problem. Since the script is run by including it, e.g. in the zsh plugin, this will exit the terminal it's run in and not a subshell like usual. How about making it an else if the the if-statement right below it? The script will then exit normally, but nothing will actually be run.

@malthejorgensen
Copy link
Contributor Author

I added a new commit, that doesn't use exit.

The diff isn't pretty, but I just moved the $args up before the if saved the result and changed the if to elif.

@mfaerevaag mfaerevaag merged commit 2adcf77 into mfaerevaag:master Nov 21, 2013
@mfaerevaag
Copy link
Owner

Super!

Thanks again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants