Tweak background process output handling

This commit is contained in:
natemaia 2019-08-25 11:58:59 -07:00
parent 17780ed5f7
commit 831cfbcc58

View File

@ -1376,17 +1376,19 @@ install_base()
{ {
if [[ $RSYNC_PID || $MIRROR_PID ]]; then if [[ $RSYNC_PID || $MIRROR_PID ]]; then
local oldmsg="" msg="" local oldmsg="" msg=""
printf "\nOne or more background install processes are still running, grabbing their output...\n" if kill -0 "$RSYNC_PID" 2>/dev/null || kill -0 "$MIRROR_PID" 2>/dev/null; then
while kill -0 "$RSYNC_PID" 2>/dev/null || kill -0 "$MIRROR_PID" 2>/dev/null; do printf "\nOne or more background install processes are still running, grabbing their output...\n"
msg="$(tail -n 1 /tmp/bg_out)" while kill -0 "$RSYNC_PID" 2>/dev/null || kill -0 "$MIRROR_PID" 2>/dev/null; do
if [[ "$msg" != "$oldmsg" ]]; then msg="$(tail -n 1 /tmp/bg_out)"
printf "\n%s" "$msg" if [[ "$msg" != "$oldmsg" ]]; then
oldmsg="$msg" printf "\n%s" "$msg"
else oldmsg="$msg"
printf "." else
sleep 0.5 printf "."
fi sleep 0.5
done fi
done
fi
trap - EXIT trap - EXIT
unset RSYNC_PID MIRROR_PID unset RSYNC_PID MIRROR_PID
else else