Blob Blame History Raw
From 84b54cb2ea9c3744f327d617f2797efd1f6ac617 Mon Sep 17 00:00:00 2001
From: Dalibor Pospisil <dapospis@redhat.com>
Date: Wed, 22 May 2019 11:10:38 +0200
Subject: [PATCH 1/8] do not masque exit code by 'local' directive

if a variable is set with an command output within local directive,
the exit code of that command gets lost and exit code of the 'local'
is used instead which is basically always 0.
---
 src/journal.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/journal.sh b/src/journal.sh
index 128f9f2..2e8d616 100644
--- a/src/journal.sh
+++ b/src/journal.sh
@@ -810,8 +810,9 @@ __INTERNAL_CreateHeader(){
     __INTERNAL_LogText "    Test name     : ${__INTERNAL_TEST_NAME}" 2> /dev/null
 
     local test_version="${testversion:-$TESTVERSION}"
+    local test_rpm
     # get number of itesm of BASH_SOURCE-1 to get last item of the array
-    local test_rpm=$(rpm -qf ${BASH_SOURCE[$((${#BASH_SOURCE[@]}-1))]} 2> /dev/null) \
+    test_rpm=$(rpm -qf ${BASH_SOURCE[$((${#BASH_SOURCE[@]}-1))]} 2> /dev/null) \
       && test_version=$(rpm --qf "%{version}-%{release}" -q $test_rpm 2> /dev/null)
 
     [[ -n "$test_version" ]] && {
-- 
2.21.0