Revision 12974
Added by Aaron Marcuse-Kubitza almost 11 years ago
trunk/lib/sh/util.sh | ||
---|---|---|
228 | 228 |
declare e="$(if test "$e_" = 0; then echo "${e:-0}"; else echo "$e_"; fi)"' |
229 | 229 |
|
230 | 230 |
alias rethrow!='errexit "$e"' |
231 |
alias rethrow_exit!='errexit "$e"' |
|
232 | 231 |
|
233 | 232 |
alias rethrow='{ if test "$e" != 0; then rethrow!; fi; }' |
234 |
alias rethrow_exit='{ if test "$e" != 0; then rethrow_exit!; fi; }' |
|
235 |
alias rethrow_subshell='rethrow_exit' |
|
236 | 233 |
|
237 | 234 |
fi # load new aliases |
238 | 235 |
if self_being_included; then |
... | ... | |
251 | 248 |
ignore_e() { catch "$@" || true; } # also works w/ $1='' |
252 | 249 |
|
253 | 250 |
alias end_try='rethrow' |
254 |
alias end_try_subshell='rethrow_subshell'
|
|
251 |
alias end_try_subshell='rethrow' |
|
255 | 252 |
|
256 | 253 |
ignore() { save_e; ignore_e "$@"; rethrow; } # usage: try cmd || ignore status |
257 | 254 |
|
... | ... | |
875 | 872 |
# handle any error |
876 | 873 |
e="${PIPESTATUS_[0]}" # 1st command's exit status -> $e |
877 | 874 |
ignore_e "$ignore_e" # also works w/ ignore_e='' |
878 |
rethrow_exit
|
|
875 |
rethrow |
|
879 | 876 |
|
880 | 877 |
return "${PIPESTATUS_[1]}" # 2nd command's exit status -> $? |
881 | 878 |
} |
Also available in: Unified diff
lib/sh/util.sh: removed separate rethrow_exit*, rethrow_subshell*, since they now do the same thing as rethrow*