From 2fd986f911197d06bf394601490c00b7ea486cea Mon Sep 17 00:00:00 2001 From: Patrick Van der Veken Date: Mon, 30 Apr 2018 12:00:14 +0200 Subject: [PATCH] Fix for non-executing END {} block --- sources/lib/core/report_std.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sources/lib/core/report_std.sh b/sources/lib/core/report_std.sh index 1328a5f..afc32ed 100644 --- a/sources/lib/core/report_std.sh +++ b/sources/lib/core/report_std.sh @@ -77,7 +77,9 @@ then _HC_LAST_TIME="-" _HC_LAST_STC="-" else - awk -F "${SEP}" -v needle_time="${_HC_LAST_TIME}" -v needle_hc="${_HC_LAST}" \ + # use of cat is not useless here, makes sure END {} gets executed even + # if $_LOG STASH contains non-existing files (because of * wildcard) + cat ${_LOG_STASH} 2>/dev/null | awk -F "${SEP}" -v needle_time="${_HC_LAST_TIME}" -v needle_hc="${_HC_LAST}" \ ' BEGIN { last_stc = 0 @@ -93,9 +95,8 @@ then } END { print last_fail_id, last_stc - } - ' ${_LOG_STASH} 2>/dev/null | read _HC_LAST_FAIL_ID _HC_LAST_STC + ' 2>/dev/null | read _HC_LAST_FAIL_ID _HC_LAST_STC fi # report on findings printf "| %-30s | %-20s | %-14s | %-4s\n" \