use PIPESTATUS to capture mvn exit code in the presence of tee

This commit is contained in:
Axel Uhl committed 2014-01-30 20:53:11 +01:00
1 parent 842deaea16
commit ab55a254b8
1 file changed
+3 -2
+3 -2
View File
@@ -480,8 +480,9 @@ if [[ "$@" == "build" ]] || [[ "$@" == "all" ]]; then
echo "Using following command: mvn $extra -DargLine=\"$APP_PARAMETERS\" -fae -s $MAVEN_SETTINGS $clean install"
echo "Maven version used: `mvn --version`"
(mvn $extra -DargLine="$APP_PARAMETERS" -fae -s $MAVEN_SETTINGS $clean install; echo MVN_EXIT_CODE=$?) 2>&1 | tee $START_DIR/build.log
eval `grep MVN_EXIT_CODE= $START_DIR/build.log`
mvn $extra -DargLine="$APP_PARAMETERS" -fae -s $MAVEN_SETTINGS $clean install 2>&1 | tee $START_DIR/build.log
# now get the exit status from mvn, and not that of tee which is what $? contains now
MVN_EXIT_CODE=${PIPESTATUS[0]}
echo "Maven exit code is $MVN_EXIT_CODE"
if [ $reporting -eq 1 ]; then