mirror of
https://github.com/darlinghq/darling-dyld.git
synced 2024-11-26 22:00:26 +00:00
11 lines
408 B
Bash
11 lines
408 B
Bash
exit_if_error() {
|
|
local exit_code=$1
|
|
shift
|
|
[[ $exit_code ]] && # do nothing if no error code passed
|
|
((exit_code != 0)) && { # do nothing if error code is 0
|
|
printf 'ERROR: %s\n' "$@" >&2 # we can use better logging here
|
|
exit "$exit_code" # we could also check to make sure
|
|
# error code is numeric when passed
|
|
}
|
|
}
|