aboutsummaryrefslogtreecommitdiffstats
path: root/.config/init/helpers
diff options
context:
space:
mode:
authorkatherine <shmibs@airen-no-jikken.icu>2018-12-22 14:00:24 -0700
committerkatherine <shmibs@airen-no-jikken.icu>2018-12-22 14:00:24 -0700
commitd25cec232053467d9c5ce10a5262cce52324fbab (patch)
tree787ef6e1f90ddb215b48d7e0d8f760848e942808 /.config/init/helpers
parentcda3ce7be62bd74452a10d8a83055a7969b171db (diff)
downloaddotfiles-d25cec232053467d9c5ce10a5262cce52324fbab.tar.gz
clean wait-anim
Diffstat (limited to '.config/init/helpers')
-rw-r--r--.config/init/helpers23
1 files changed, 14 insertions, 9 deletions
diff --git a/.config/init/helpers b/.config/init/helpers
index 81859ec..37ae17a 100644
--- a/.config/init/helpers
+++ b/.config/init/helpers
@@ -160,16 +160,21 @@ wait-anim() {
6) frames=('O' 'o' '.' 'o') ;;
esac
- (while 2>/dev/null kill -0 $1; do
+ local rval
+
+ {
+ wait $1
+ rval=$?
+ echo "done"
+ } | while true; do
[[ -z $curframe ]] && curframe=0
printf "\e[G\e[K|\e[1;32m${frames[$(($curframe + 1))]}\e[0m| $colour$message...\e[0m"
curframe=$(( ($curframe + 1) % $#frames ))
- sleep .2
- done) &
-
- wait $1
- local r=$?
- [[ $r ]] && printf "\e[G\e[K\e[31m$message... failed!\e[0m\n" \
- || printf "\e[G\e[K\e[32m$message... done!\e[0m\n"
- return $r
+ read -t 0.2 && break
+ done
+
+ [[ $rval -eq 0 ]] && printf "\e[G\e[K\e[32m$message... done!\e[0m\n" \
+ || printf "\e[G\e[K\e[31m$message... failed!\e[0m\n"
+
+ return $rval
}