Browse code

Merge "Kill spinner process when stack.sh exits"

Jenkins authored on 2014/05/03 04:20:29
Showing 1 changed files
... ...
@@ -494,14 +494,18 @@ function spinner {
494 494
     done
495 495
 }
496 496
 
497
+function kill_spinner {
498
+    if [ ! -z "$LAST_SPINNER_PID" ]; then
499
+        kill >/dev/null 2>&1 $LAST_SPINNER_PID
500
+        printf "\b\b\bdone\n" >&3
501
+    fi
502
+}
503
+
497 504
 # Echo text to the log file, summary log file and stdout
498 505
 # echo_summary "something to say"
499 506
 function echo_summary {
500 507
     if [[ -t 3 && "$VERBOSE" != "True" ]]; then
501
-        kill >/dev/null 2>&1 $LAST_SPINNER_PID
502
-        if [ ! -z "$LAST_SPINNER_PID" ]; then
503
-            printf "\b\b\bdone\n" >&3
504
-        fi
508
+        kill_spinner
505 509
         echo -n -e $@ >&6
506 510
         spinner &
507 511
         LAST_SPINNER_PID=$!
... ...
@@ -612,6 +616,10 @@ function exit_trap {
612 612
         echo "exit_trap: cleaning up child processes"
613 613
         kill 2>&1 $jobs
614 614
     fi
615
+
616
+    # Kill the last spinner process
617
+    kill_spinner
618
+
615 619
     exit $r
616 620
 }
617 621