From f9b247d42bd522fdd134352f7f3ec8e40a85055d Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Fri, 5 Jul 2024 10:11:57 +0000 Subject: [PATCH] make.sh: Show total runtime of commands after they are finished Signed-off-by: Michael Tremer --- make.sh | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/make.sh b/make.sh index c04d86fc4..3062e20f8 100755 --- a/make.sh +++ b/make.sh @@ -806,15 +806,28 @@ run_command() { ;; esac + # Return code + local r=0 + + # Store the start time + local t="${SECONDS}" + # Run the command and pipe all output to the logfile if ! "${command[@]}" >> "${LOGFILE}" 2>&1; then - print_status FAIL - return 1 + r="$?" fi + # Print the runtime + print_runtime "$(( SECONDS - t ))" + # All done - print_status DONE - return 0 + if [ "${r}" -eq 0 ]; then + print_status DONE + else + print_status FAIL + fi + + return "${r}" } lfsmake2() { -- 2.39.5