aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Ferrell <major@homeonderanged.org>2014-01-15 10:02:10 -0800
committerMark Ferrell <major@homeonderanged.org>2014-01-15 10:02:10 -0800
commit23f0fc4e6fc8c3aa6d497eeeec1158881c05573b (patch)
treecff2cb2f44ee51298a94214dac682eb38e368bb4
parent539129f44f0adf7d8c20875daacc3b3e33d58fdb (diff)
Properly capture the exit status
* We use the 'tee' command to capture our output to the builder.log. The problem is that 'tee' discards the exit status. Added a wrapper function to capture the exit status and handed the output from the function to 'tee'. * Fixes #52
-rwxr-xr-xbuild12
1 files changed, 10 insertions, 2 deletions
diff --git a/build b/build
index 59a48c8..dc612b7 100755
--- a/build
+++ b/build
@@ -358,5 +358,13 @@ done
set -- ${packages}
unset packages
-# exec out to make with the appropriate Makefile
-make ${MAKE_OPTS} -r -f "${BUILDER_MAKEFILE}" "${@}" 2>&1 | tee "${BUILDER_TMPDIR}/builder.log"
+# The 'tee' command will discard the exit status from 'make', so we capture it
+# via a wrapper function so we can exit properly.
+build_make()
+{
+ BUILD_EXIT='0'
+ make -r -f "${BUILDER_MAKEFILE}" "${@}"
+ BUILD_EXIT="$?"
+}
+build_make "${@}" 2>&1 | tee "${BUILDER_TMPDIR}/builder.log"
+exit "${BUILD_EXIT}"