From eeac46480591a06ec8beba6b1541d0f0081cfd5b Mon Sep 17 00:00:00 2001 From: Aaron LI Date: Sun, 3 Jun 2018 20:30:28 +0800 Subject: 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. --- dfly-update | 5 +++-- 1 file 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: -- cgit v1.2.2