summaryrefslogtreecommitdiff
path: root/docker
diff options
context:
space:
mode:
authorcybuzuma <106408965+cybuzuma@users.noreply.github.com>2022-12-13 08:18:53 +0100
committerGitHub <noreply@github.com>2022-12-13 08:18:53 +0100
commit081cc60aa501f22747b994c70abcb0a59371075c (patch)
tree66d58250c469deeda942fe4b3501a214632b230a /docker
parent1062fec5f2f1e84a07fb1e5a752a0c1121a09448 (diff)
fixing build.sh not returning error in build (#1460)
Return the build status as return code from the `main` helper function. In the process convert the handling if the file was sourced or directly executed into an explicit if/else statement to make the intent clearer. In case of an build error the error is now reported at the build step, where the error happened. Fixes: https://github.com/InfiniTimeOrg/InfiniTime/issues/1292
Diffstat (limited to 'docker')
-rwxr-xr-xdocker/build.sh12
1 files changed, 11 insertions, 1 deletions
diff --git a/docker/build.sh b/docker/build.sh
index 07e0d17e..b9034a53 100755
--- a/docker/build.sh
+++ b/docker/build.sh
@@ -41,6 +41,8 @@ main() {
if [ "$DISABLE_POSTBUILD" != "true" -a "$BUILD_RESULT" == 0 ]; then
source "$BUILD_DIR/post_build.sh"
fi
+ # assuming post_build.sh will never fail on a successful build
+ return $BUILD_RESULT
}
GetGcc() {
@@ -77,4 +79,12 @@ CmakeBuild() {
fi
}
-[[ $SOURCED == "false" ]] && main "$@" || echo "Sourced!"
+if [[ $SOURCED == "false" ]]; then
+ # It is important to return exit code of main
+ # To be future-proof, this is handled explicitely
+ main "$@"
+ BUILD_RESULT=$?
+ exit $BUILD_RESULT
+else
+ echo "Sourced!"
+fi