From 041f2ed4be9876313962004d4b2ec6d55a7c2c94 Mon Sep 17 00:00:00 2001 From: George Boudreau Date: Thu, 29 Jun 2006 00:36:22 +0000 Subject: [PATCH] Replace fuser process lookup with test for directory existance in /proc. fuser has a high cpu cost for smaller systems --- common/progress_bar.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/common/progress_bar.sh b/common/progress_bar.sh index aaa1af1..7191777 100755 --- a/common/progress_bar.sh +++ b/common/progress_bar.sh @@ -21,14 +21,16 @@ declare -a GRAPHIC_STR="| / - \\ + " declare -i SEC=0 # Seconds accumulator declare -i PREV_SEC=0 +makePID=$(fuser -v . 2>&1 | grep make) +makePID=$(echo $makePID | cut -d" " -f2) write_or_exit() { # make has been killed or failed or run to completion, leave - if ! fuser -v . 2>&1 | grep make >/dev/null ; then - echo -n "${CURSOR_ON}" && exit - fi + [[ ! -e /proc/$makePID ]] && echo -n "progress bar dies:${CURSOR_ON}" && exit + # Target build complete, leave. [[ -f ${TARGET} ]] && echo -n "${CURSOR_ON}" && exit + # It is safe to write to the screen echo -n "$1" }