dev-setup icon indicating copy to clipboard operation
dev-setup copied to clipboard

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

Open dportabella opened this issue 9 years ago • 2 comments

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

dportabella avatar May 29 '16 00:05 dportabella

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.

donnemartin avatar Jun 01 '16 02:06 donnemartin

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

dportabella avatar Jun 01 '16 06:06 dportabella