mirror of
https://codeberg.org/libreboot/lbmk.git
synced 2026-07-14 15:29:35 +02:00
lbmk: Replace err with much simpler implementation
The current implementation is insanely over-engineered, and completely unnecessary. Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
@@ -184,28 +184,6 @@ x_()
|
||||
err()
|
||||
{
|
||||
set -u -e
|
||||
|
||||
xbmk_err_val=0
|
||||
real_err="" && [ -n "${xbmk_err+x}" ] && real_err="$xbmk_err"
|
||||
|
||||
if [ -z "$real_err" ]; then
|
||||
printf "WARNING: err not set. Defaulting to 'err_'\n" 1>&2
|
||||
real_err="err_"
|
||||
fi
|
||||
|
||||
(
|
||||
$real_err "$@" || err_ "Error function '$real_err' *returned* 1"
|
||||
err_ "Error function '$real_err' didn't exit"
|
||||
exit 1 # just in case!
|
||||
) || xbmk_err_val=1 # otherwise, it wrongly did exit 0, not exit 1
|
||||
|
||||
[ $xbmk_err_val -eq 0 ] && err_ "Error function '$real_err' did exit 0"
|
||||
exit 1 # just in case!
|
||||
}
|
||||
|
||||
err_()
|
||||
{
|
||||
[ $# -lt 1 ] && printf "ERROR (but no error message provided)\n" 1>&2
|
||||
[ $# -lt 1 ] || printf "ERROR %s: %s\n" "$0" "$1" 1>&2 || :
|
||||
exit 1
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user