From d280aaffa6a3582a9247c3dcd4ede5aaaafeb32e Mon Sep 17 00:00:00 2001 From: Joe cooper Date: Fri, 26 May 2017 16:51:50 -0500 Subject: [PATCH] Positional printf --- slib.sh | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/slib.sh b/slib.sh index 317a790..c8acc71 100644 --- a/slib.sh +++ b/slib.sh @@ -165,7 +165,7 @@ log() { # LOG_PATH minus fancypants colors if [ ! -z "$LOG_PATH" ]; then today=$(date +"%Y-%m-%d %H:%M:%S %Z") - printf "[${today}] [${log_level}] ${log_text}\n" >> "$LOG_PATH" + printf "[%s] [%s] %s\n" "$today" "$log_levvel" "$log_text" >> "$LOG_PATH" fi fi @@ -338,17 +338,16 @@ run_ok () { CHECK='\u2714' BALLOT_X='\u2718' spinner & - local spinpid=$! + spinpid=$! + echo "Spin pid is: $spinpid" >> ${RUN_LOG} eval "${cmd}" 1>> ${RUN_LOG} 2>&1 local res=$? touch stopspinning - while [ -f stopspinning ]; do - sleep .2 # It's possible to have a race for stdout and spinner clobbering the next bit - done + sleep .2 # It's possible to have a race for stdout and spinner clobbering the next bit # Just in case the spinner survived somehow, kill it. - local pidcheck pidcheck=$(ps --no-headers ${spinpid}) if [ ! -z "$pidcheck" ]; then + echo "Made it here...why?" >> ${RUN_LOG} kill $spinpid 2>/dev/null fi # Log what we were supposed to be running