Fixed ctrl-c for the gradle build

This commit is contained in:
Ziver Koc 2021-09-06 16:17:11 +02:00
parent b94b33ecf1
commit 6cb0a2ddf0

17
run.sh
View file

@ -5,15 +5,15 @@
# ----------------------------------------------- # -----------------------------------------------
function printHelp() { function printHelp() {
echo "Run code analysis through SonarQube. echo "Wrapper for simplifying execution of Hal Server.
Usage: Usage:
$(basename $0) $(basename $0)
[-f|--foreground] [-f|--foreground]
[-h|--help] [-h|--help]
Where: Where:
--foreground Run Hal Server in the foreground instead of detatching a new screen. --foreground Run Hal Server in the foreground instead of detaching a new screen.
--help Print this help message. --help Print this help message.
" "
} }
@ -27,8 +27,15 @@ until [[ $# -eq 0 ]]; do
shift shift
;; ;;
-h|--help)
printHelp
exit 0
;;
*) *)
echo "ERROR: Unknown input parameter: $1=$2" echo "ERROR: Unknown input parameter: $1=$2"
echo ""
printHelp
exit 1 exit 1
;; ;;
esac esac
@ -40,6 +47,10 @@ done
# Execute # Execute
# ----------------------------------------------- # -----------------------------------------------
# gradle returns normally when doing ctr-c so we need to add a
# trap where the bash script exits instead of continuing.
trap 'exit 130' INT
# Build Hal source # Build Hal source
./gradlew build ./gradlew build