Replace fuser process lookup with test for directory existance in /proc. fuser has a high cpu cost for smaller systems

This commit is contained in:
George Boudreau 2006-06-29 00:36:22 +00:00
parent 385fefdec7
commit 041f2ed4be

View file

@ -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"
}