[Fuego] [PATCH 04/29] functions: handle errors properly
Daniel Sangorrin
daniel.sangorrin at toshiba.co.jp
Fri Jul 21 08:01:55 UTC 2017
If we run bash with the e flag, errors will not be handled
properly.
Signed-off-by: Daniel Sangorrin <daniel.sangorrin at toshiba.co.jp>
---
engine/scripts/functions.sh | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/engine/scripts/functions.sh b/engine/scripts/functions.sh
index ddb628f..a225273 100755
--- a/engine/scripts/functions.sh
+++ b/engine/scripts/functions.sh
@@ -360,22 +360,22 @@ function fetch_results {
call_if_present test_fetch_results
}
+# process the fetched data
function processing {
- # process the fetched data
- call_if_present test_processing
- if [ $? -ne 0 ]; then
+ call_if_present test_processing && rc=0 || rc=$?
+ if [ $rc -ne 0 ]; then
echo "ERROR: test_processing returned an error"
RETURN_VALUE=1
fi
- fail_check_cases
- if [ $? -ne 0 ]; then
+ fail_check_cases && rc=0 || rc=$?
+ if [ $rc -ne 0 ]; then
echo "ERROR: fail_check_cases returned an error"
RETURN_VALUE=1
fi
- syslog_cmp
- if [ $? -ne 0 ]; then
+ syslog_cmp && rc=0 || rc=$?
+ if [ $rc -ne 0 ]; then
echo "ERROR: syslog_cmp returned an error"
RETURN_VALUE=1
fi
--
2.7.4
More information about the Fuego
mailing list