HCPpipelines icon indicating copy to clipboard operation
HCPpipelines copied to clipboard

add 'set -E' to debug.shlib to abort on abnormal exit inside functions

Open coalsont opened this issue 5 years ago • 0 comments

This needs nearly-exhaustive testing, because despite being a small edit, a lot of scripts now use debug.shlib.

The base issue is that trap ... ERR does not work inside functions by default, so any processing that occurs inside a function that would have aborted with set -e set, does NOT get caught by debug.shlib (until this edit). However, from reading the bash manpage, it seems that with this new edit, trap ... ERR may apply in some contexts where set -e may have allowed the script to continue.

This edit also re-enables the warning about set -e being redundant.

coalsont avatar Nov 19 '19 00:11 coalsont