From 9862c71c160631bfc1a14ccbd42688c547ca9c0b Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Fri, 16 Aug 2013 02:18:29 -0400 Subject: support formatted messages to stat_busy, lock, and slock --- lib/common.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'lib') diff --git a/lib/common.sh b/lib/common.sh index c9deebc..5a9f6fe 100644 --- a/lib/common.sh +++ b/lib/common.sh @@ -50,7 +50,7 @@ error() { stat_busy() { local mesg=$1; shift - printf "${GREEN}==>${ALL_OFF}${BOLD} ${mesg}...${ALL_OFF}" >&2 + printf "${GREEN}==>${ALL_OFF}${BOLD} ${mesg}...${ALL_OFF}" "$@" >&2 } stat_done() { @@ -140,7 +140,7 @@ get_full_version() { lock() { local fd=$1 local file=$2 - local mesg=$3 + local mesg=("$@:3") # Only reopen the FD if it wasn't handed to us if [[ "$(readlink -f /dev/fd/$fd)" != "$(readlink -f "$file")" ]]; then @@ -149,7 +149,7 @@ lock() { fi if ! flock -n $fd; then - stat_busy "$mesg" + stat_busy "${mesg[@]}" flock $fd stat_done fi @@ -161,7 +161,7 @@ lock() { slock() { local fd=$1 local file=$2 - local mesg=$3 + local mesg=("$@:3") # Only reopen the FD if it wasn't handed to us if [[ "$(readlink -f /dev/fd/$fd)" != "$(readlink -f "$file")" ]]; then @@ -171,7 +171,7 @@ slock() { eval "exec $fd>"'"$file"' if ! flock -sn $fd; then - stat_busy "$mesg" + stat_busy "${mesg[@]}" flock -s $fd stat_done fi -- cgit v1.2.3-70-g09d2