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

Ensure script fails if any of its commands fails #40

Open
CodingMarkus opened this issue Dec 30, 2021 · 0 comments
Open

Ensure script fails if any of its commands fails #40

CodingMarkus opened this issue Dec 30, 2021 · 0 comments

Comments

@CodingMarkus
Copy link

Currently the script misses set -e. As a result, if one of the commands terminate with a non-zero exit code, indicating failure, the script just continues.

E.g. a past version of the script failed to apply a patch using patch -p1 -N -r - < "$i" but that didn't cause the script to terminate, it just continued and the build did not contain the patch. I would expect the same thing to happen if make fails, in which case it will just call make install anyway, which will fail as well and then just continue to the next build.

Also with set -e, you can forgo constructs like this cd "$FREETYPE" || exit 1, as if the cd fails, its exit code won't be zero and the script will terminate automatically.

set -e is a POSIX flag, all shells do support it. Without that, plenty of failures can go unnoticed and lead to strange results and hard to trace bugs.

If you still want to allow a command to fail, this is possible using do_something || true; if do_something fails, the script will not exit and just ignore that fact. Currently all your calls are like that because of the missing flag.

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

No branches or pull requests

1 participant