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:
parent
385fefdec7
commit
041f2ed4be
1 changed files with 5 additions and 3 deletions
|
@ -21,14 +21,16 @@ declare -a GRAPHIC_STR="| / - \\ + "
|
||||||
declare -i SEC=0 # Seconds accumulator
|
declare -i SEC=0 # Seconds accumulator
|
||||||
declare -i PREV_SEC=0
|
declare -i PREV_SEC=0
|
||||||
|
|
||||||
|
makePID=$(fuser -v . 2>&1 | grep make)
|
||||||
|
makePID=$(echo $makePID | cut -d" " -f2)
|
||||||
|
|
||||||
write_or_exit() {
|
write_or_exit() {
|
||||||
# make has been killed or failed or run to completion, leave
|
# make has been killed or failed or run to completion, leave
|
||||||
if ! fuser -v . 2>&1 | grep make >/dev/null ; then
|
[[ ! -e /proc/$makePID ]] && echo -n "progress bar dies:${CURSOR_ON}" && exit
|
||||||
echo -n "${CURSOR_ON}" && exit
|
|
||||||
fi
|
|
||||||
# Target build complete, leave.
|
# Target build complete, leave.
|
||||||
[[ -f ${TARGET} ]] && echo -n "${CURSOR_ON}" && exit
|
[[ -f ${TARGET} ]] && echo -n "${CURSOR_ON}" && exit
|
||||||
|
|
||||||
# It is safe to write to the screen
|
# It is safe to write to the screen
|
||||||
echo -n "$1"
|
echo -n "$1"
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue