aboutsummaryrefslogtreecommitdiffstats
path: root/.config/init/helpers
diff options
context:
space:
mode:
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
}