make.sh: Update the runtime after the interrupt

This is a lot better because this puts the code where it is being
executed and allows us to run run_command in a subshell, too.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
This commit is contained in:
Michael Tremer
2024-07-05 15:32:45 +00:00
parent 513814ab98
commit 6e6cb04630

23
make.sh
View File

@@ -396,16 +396,8 @@ __timer() {
}
# Called when the timer triggers
# This function does nothing, but is needed interrupt the wait call
__timer_event() {
local t
# If we have a running process, we update the runtime
# every time this is being triggered
if [ -n "${TIMER}" ] && [ "${TIMER}" -gt 0 ]; then
# Print the runtime
print_runtime "${TIMER} - $(( SECONDS - TIMER ))"
fi
return 0
}
@@ -832,10 +824,7 @@ run_command() {
# If we are not running in quiet mode, we set the timer
case "${quiet}" in
false)
# Launch the timer
launch_timer
TIMER="${t}"
;;
esac
@@ -850,6 +839,13 @@ run_command() {
# If the return code is >= 128, wait has been interrupted by the timer
if [ "$?" -ge 128 ]; then
# Update the runtime
case "${quiet}" in
false)
print_runtime "$(( SECONDS - t ))"
;;
esac
continue
fi
@@ -858,9 +854,6 @@ run_command() {
break
done
# Clear the timer
TIMER=0
# Show runtime and status unless quiet
case "${quiet}" in
false)