]> git.ipfire.org Git - people/ms/ipfire-2.x.git/commitdiff
make.sh: Update the runtime after the interrupt
authorMichael Tremer <michael.tremer@ipfire.org>
Fri, 5 Jul 2024 15:32:45 +0000 (15:32 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Mon, 8 Jul 2024 15:39:44 +0000 (15:39 +0000)
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>
make.sh

diff --git a/make.sh b/make.sh
index 537bd2eba6a1504d23c362683a75ea985e68909f..12b3deff57aa737e057a6d0fe3ea25ff310b17bc 100755 (executable)
--- a/make.sh
+++ b/make.sh
@@ -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)