Revision 12772
Added by Aaron Marcuse-Kubitza almost 11 years ago
util.sh | ||
---|---|---|
219 | 219 |
declare e_=$?; |
220 | 220 |
declare e="$(if test "$e_" = 0; then echo "${e:-0}"; else echo "$e_"; fi)"' |
221 | 221 |
|
222 |
alias rethrow='return "$e"' |
|
222 |
alias rethrow!='return "$e"'
|
|
223 | 223 |
# can't use `(exit "$e")` because a bug in bash prevents subshells from |
224 | 224 |
# triggering errexit (would need to append `|| return` for it to work) |
225 |
alias rethrow_subshell='exit "$e"' |
|
225 |
alias rethrow_subshell!='exit "$e"'
|
|
226 | 226 |
|
227 |
alias rethrow='{ if test "$e" != 0; then rethrow!; fi; }' |
|
228 |
alias rethrow_subshell='{ if test "$e" != 0; then rethrow_subshell!; fi; }' |
|
229 |
|
|
227 | 230 |
fi # load new aliases |
228 | 231 |
if self_being_included; then |
229 | 232 |
|
Also available in: Unified diff
bugfix: lib/sh/util.sh: rethrow*: only `return` if $e is actually nonzero, because rethrow is now being used as a catch-all in situations where there might not be an error