scripts/functions: return a proper error code in CT_DoExecLog
author"Yann E. MORIN" <yann.morin.1998@free.fr>
Sun Oct 21 22:27:17 2012 +0200 (2012-10-21)
changeset 30850c3f8dd9d184
parent 3084 95df9d32afd2
child 3086 946d6d133a90
scripts/functions: return a proper error code in CT_DoExecLog

Since we added the debug-shell feature, CT_DoExecLog no longer
returns the error code of the command, but always return 0.

This breaks the download mechanism, which relies on CT_DoExecLog
to fail _on_purpose_ to detect that the ressource was not found
at the specified URL.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
scripts/functions
     1.1 --- a/scripts/functions	Wed Oct 17 22:01:25 2012 +0200
     1.2 +++ b/scripts/functions	Sun Oct 21 22:27:17 2012 +0200
     1.3 @@ -216,6 +216,7 @@
     1.4  CT_DoExecLog() {
     1.5      local level="$1"
     1.6      local cur_cmd
     1.7 +    local ret
     1.8      shift
     1.9      (
    1.10      for i in "$@"; do
    1.11 @@ -254,12 +255,14 @@
    1.12          rm -f "${CT_BUILD_DIR}/repeat"
    1.13          CT_DoLog DEBUG "==> Executing: ${cur_cmd}"
    1.14          "${@}" 2>&1 |CT_DoLog "${level}"
    1.15 +        ret="${?}"
    1.16          if [ -f "${CT_BUILD_DIR}/repeat" ]; then
    1.17              continue
    1.18          else
    1.19              break
    1.20          fi
    1.21      done
    1.22 +    exit ${ret}
    1.23      )
    1.24      # Catch failure of the sub-shell
    1.25      [ $? -eq 0 ]
    1.26 @@ -570,9 +573,11 @@
    1.27      then
    1.28          # Success, we got it, good!
    1.29          mv "${tmp}" "${dest}"
    1.30 +        CT_DoLog DEBUG "Got it from: \"${url}\""
    1.31      else
    1.32          # Woops...
    1.33          rm -f "${tmp}"
    1.34 +        CT_DoLog DEBUG "Not at this location: \"${url}\""
    1.35      fi
    1.36  }
    1.37