common: save the existing return value on cleanup
Currently this trap initiated function will not save the orginal return
value of the script. Save it and return it on exit.
BUG=chromium:1141907
TEST=unittest and manually on a signer
BRANCH=None
Signed-off-by: George Engelbrecht <engeg@google.com>
Change-Id: Icd807f4d153e4bcc1d309fbcea43c2b3344771ca
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/2514560
Reviewed-by: Sean McAllister <smcallis@google.com>
Reviewed-by: LaMont Jones <lamontjones@chromium.org>
diff --git a/scripts/image_signing/common.sh b/scripts/image_signing/common.sh
index 5f5287a..f1fd3ef 100644
--- a/scripts/image_signing/common.sh
+++ b/scripts/image_signing/common.sh
@@ -32,6 +32,8 @@
# Performs clean up by executing actions in the cleanup_actions array in
# reversed order.
cleanup() {
+ # Save the existing return value.
+ rv=$?
set +e
while [ ${#cleanup_actions[*]} -gt 0 ]; do
@@ -39,6 +41,7 @@
done
set -e
+ return $rv
}
# ANSI color codes used when displaying messages.