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

Logic for when $METHOD is something unexpected #1917

Merged
merged 1 commit into from
Oct 8, 2018

Conversation

pnickerson-cashstar
Copy link
Contributor

Print an error and exit the script if $METHOD is set to something unexpected.

In my own personal case, Salt was setting $METHOD to "loopback", and I did not realize it. With this patch, the script output will make it clear what's going on, and it will not pretend to complete successfully.

I did a small amount of testing of my own, but I don't have the tools or experience to complete all the testing asked for in CONTRIBUTING.md. Can someone else help with that?

install.sh Outdated
@@ -329,6 +329,9 @@ nvm_do_install() {
exit 1
fi
install_nvm_as_script
else
echo >&2 'The environment variable $METHOD is set to "'"${METHOD}"'", which is not recognized as a valid installation method.'
Copy link
Member

Choose a reason for hiding this comment

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

Why the "'" thing, instead of something like this?:

echo >&2 "The environment variable \$METHOD is set to \"${METHOD}\", which is not recognized as a valid installation method.'

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Personal style. \" is fine too. I just use "'" by default because \" has been difficult for me to get right when doing more complex quotation escapes in Bash.

Copy link
Member

Choose a reason for hiding this comment

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

it seems like shellcheck is erroring out on this. can you update it so tests are passing? style choices beyond that can be figured out later :-)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If I'm reading it right, this is the cause of the failure: "SC2016: Expressions don't expand in single quotes, use double quotes for that." I think getting rid of the single quotes like you suggest will fix that, so I'll give it a try.

@ljharb ljharb added the installing nvm Problems installing nvm itself label Oct 2, 2018
Copy link
Member

@ljharb ljharb left a comment

Choose a reason for hiding this comment

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

Thanks!

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

Successfully merging this pull request may close these issues.

2 participants