Skip to content

Commit

Permalink
Fix to correctly lock the spinner and clean up on exit
Browse files Browse the repository at this point in the history
  • Loading branch information
iliajie committed Sep 22, 2024
1 parent 1263f1c commit 2484cc4
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions slib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
cleanup () {
exit_code=$1
stty echo
echo
# Make super duper sure we reap all the spinners
# This is ridiculous, and I still don't know why spinners stick around.
if [ -n "$allpids" ]; then
Expand Down Expand Up @@ -345,6 +346,7 @@ run_ok () {
CHECK='\u2714'
BALLOT_X='\u2718'
if [ "${INTERACTIVE_MODE}" != "off" ];then
stty -echo
spinner &
spinpid=$!
allpids="$allpids $spinpid"
Expand All @@ -356,6 +358,7 @@ run_ok () {
env sleep .4 # It's possible to have a race for stdout and spinner clobbering the next bit
# Just in case the spinner survived somehow, kill it.
if [ "${INTERACTIVE_MODE}" != "off" ];then
stty echo
pidcheck=$(ps --no-headers ${spinpid})
if [ -n "$pidcheck" ]; then
echo "$log_pref Made it here...why?" >> ${RUN_LOG}
Expand Down

0 comments on commit 2484cc4

Please sign in to comment.