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>
This commit is contained in:
Yann E. MORIN" 2012-10-21 22:27:17 +02:00
parent 623a30ed45
commit f378c3c1ff

View File

@ -216,6 +216,7 @@ CT_DoLog() {
CT_DoExecLog() {
local level="$1"
local cur_cmd
local ret
shift
(
for i in "$@"; do
@ -254,12 +255,14 @@ CT_DoExecLog() {
rm -f "${CT_BUILD_DIR}/repeat"
CT_DoLog DEBUG "==> Executing: ${cur_cmd}"
"${@}" 2>&1 |CT_DoLog "${level}"
ret="${?}"
if [ -f "${CT_BUILD_DIR}/repeat" ]; then
continue
else
break
fi
done
exit ${ret}
)
# Catch failure of the sub-shell
[ $? -eq 0 ]
@ -570,9 +573,11 @@ CT_DoGetFile() {
then
# Success, we got it, good!
mv "${tmp}" "${dest}"
CT_DoLog DEBUG "Got it from: \"${url}\""
else
# Woops...
rm -f "${tmp}"
CT_DoLog DEBUG "Not at this location: \"${url}\""
fi
}