Revision 12973
Added by Aaron Marcuse-Kubitza almost 11 years ago
trunk/lib/sh/util.sh | ||
---|---|---|
227 | 227 |
declare e_=$?; |
228 | 228 |
declare e="$(if test "$e_" = 0; then echo "${e:-0}"; else echo "$e_"; fi)"' |
229 | 229 |
|
230 |
alias rethrow!='return "$e"' |
|
231 |
# can't use `(exit "$e")` because a bug in bash prevents subshells from |
|
232 |
# triggering errexit (would need to append `|| return` for it to work) |
|
233 |
alias rethrow_exit!='exit "$e"' |
|
230 |
alias rethrow!='errexit "$e"' |
|
231 |
alias rethrow_exit!='errexit "$e"' |
|
234 | 232 |
|
235 | 233 |
alias rethrow='{ if test "$e" != 0; then rethrow!; fi; }' |
236 | 234 |
alias rethrow_exit='{ if test "$e" != 0; then rethrow_exit!; fi; }' |
Also available in: Unified diff
lib/sh/util.sh: rethrow*!: use new errexit, which works in functions and subshells