Skip to content

Commit

Permalink
Maybe reaping will do it...
Browse files Browse the repository at this point in the history
  • Loading branch information
swelljoe committed May 26, 2017
1 parent c85956f commit f4c999a
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions slib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,15 @@
# Licensed under the BSD 3 clause license
# http://github.com/virtualmin/slib
#--------------------------------------------------------------------------------------------------
#set -e # Fail on first error

cleanup () {
# Make super duper sure we reap all the spinners
# This is ridiculous, and I still don't know why spinners stick around.
if [ ! -z "$allpids" ]; then
kill "$allpids"
fi
}
trap cleanup INT EXIT QUIT TERM

# scolors - Color constants
# canonical source http://github.com/swelljoe/scolors
Expand Down Expand Up @@ -285,7 +293,6 @@ spinner () {
# run_ok - function to run a command or function, start a spinner and print a confirmation
# indicator when done.
# Canonical source - http://github.com/swelljoe/run_ok

RUN_LOG="run.log"

# Check for unicode support in the shell
Expand Down Expand Up @@ -339,6 +346,7 @@ run_ok () {
BALLOT_X='\u2718'
spinner &
spinpid=$!
allpids="$allpids $spinpid"
echo "Spin pid is: $spinpid" >> ${RUN_LOG}
eval "${cmd}" 1>> ${RUN_LOG} 2>&1
local res=$?
Expand Down

0 comments on commit f4c999a

Please sign in to comment.