trap sigint so that spinner isnt left running

This commit is contained in:
Rob Pearce 2022-07-25 20:26:56 +10:00
parent b887074869
commit bba12d9d81
1 changed files with 7 additions and 0 deletions

View File

@ -40,6 +40,7 @@ if [[ $1 != "reload" && -n $HAVE_BASHTOOLS ]]; then
return
fi
export HAVE_BASHTOOLS=1
trap bashtools_cleanup INT
SPINDELAY=0.05 # delay in ms between spinner frames
SPINNERFRAMES='|/-\'
@ -152,6 +153,12 @@ function info() {
csecho "${INFOCOL}" "^b>>^p $*" >/dev/stderr
}
function bashtools_cleanup() {
stop_spinner
innotify=0
echo -e "$PLAIN"
}
function ok() {
local msg=${*:-ok}
stop_spinner