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

For all installation scripts, exit immediately if a command exits with a non-zero status #25

Open
dportabella opened this issue May 29, 2016 · 2 comments

Comments

@dportabella
Copy link
Contributor

it's important for a script to exit immediately if a command exits with a non-zero status,
otherwise results are unpredictable.

this can be achieved by adding set -e at the beginning of all bash scripts

@donnemartin
Copy link
Owner

donnemartin commented Jun 1, 2016

Today I learned about set -e, thanks :)

My only concern about making this change right away is that there seem to be some edge cases that I haven't thought through yet.

@dportabella
Copy link
Contributor Author

welcome :)
you can also disable and re-enable this behaviour when you expect a command to produce a non-zero exit, by surrounding the command with a set +e and set -e.

set -e
normal_command
normal_command
set +e
command_with_non_zero_exit
set -e
normal_command
normal_command

@donnemartin donnemartin changed the title for all installation scripts, exit immediately if a command exits with a non-zero status For all installation scripts, exit immediately if a command exits with a non-zero status Jun 11, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants