termux-packages/scripts/updates/utils/termux_error_exit.sh
Aditya Alok e1d6ab87f6 feat(auto update): add utility function to exit on error
Signed-off-by: Aditya Alok <dev.aditya.alok@gmail.com>
2022-03-28 23:11:11 +05:30

11 lines
166 B
Bash

# shellcheck shell=bash
termux_error_exit() {
if [ "$#" -eq 0 ]; then
# Read from stdin.
printf '%s\n' "$(cat)" >&2
else
printf '%s\n' "$*" >&2
fi
exit 1
}