aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron LI <aly@aaronly.me>2018-06-03 20:30:28 +0800
committerAaron LI <aly@aaronly.me>2018-06-03 20:30:28 +0800
commiteeac46480591a06ec8beba6b1541d0f0081cfd5b (patch)
tree30c150e0d0df6487faf327bbf26effb7c82ba728
parent326c1aa05a6d82266b064200509768bbc9a272c1 (diff)
downloaddfly-update-eeac46480591a06ec8beba6b1541d0f0081cfd5b.tar.bz2
Properly capture the error code from get_latest_image()
Before this commit, get_latest_image() may fail, e.g., due to fetch errors, but the "eval" statement makes the error code from get_latest_image() function ignored.
-rwxr-xr-xdfly-update5
1 files changed, 3 insertions, 2 deletions
diff --git a/dfly-update b/dfly-update
index b10ec65..e767337 100755
--- a/dfly-update
+++ b/dfly-update
@@ -610,13 +610,14 @@ cmd_status() {
error ${EC_ARGS} "cmd_status: invalid arguments: $@"
local branch=$(get_local_branch)
local version=$(get_local_version)
- local branch_remote version_remote has_update
+ local branch_remote version_remote has_update ret
if [ -z "${UPDATE_BRANCH}" ]; then
branch_remote=${branch}
else
branch_remote=${UPDATE_BRANCH}
fi
- eval "$(get_latest_image ${branch_remote})" || exit $?
+ ret="$(get_latest_image ${branch_remote})" || exit $?
+ eval "${ret}"
version_remote=$(get_version_filename ${branch_remote} ${_filename})
cat <<_EOF_
Local installed system: