Revision 12972
Added by Aaron Marcuse-Kubitza almost 11 years ago
trunk/lib/sh/util.sh | ||
---|---|---|
211 | 211 |
|
212 | 212 |
#### exceptions |
213 | 213 |
|
214 |
errexit() # usage: cmd || errexit status # works in functions *and* subshells |
|
215 |
{ return "$1"; } |
|
216 |
# can't use `(exit "$1")` because a bug in bash prevents subshells from |
|
217 |
# triggering errexit (would need to append `|| return` for it to work) |
|
218 |
|
|
214 | 219 |
# usage: cmd || { save_e; ...; rethrow; } |
215 | 220 |
|
216 | 221 |
alias export_e='e=$?' |
Also available in: Unified diff
lib/sh/util.sh: added errexit(), used in place of (exit "$1") because a bug in bash prevents subshells from triggering errexit