lila.sh minor improvement

fix script sourced logic: return, not exit. Calling exit
terminates the "parent" shell.
This commit is contained in:
Isaac Levy
2025-12-03 11:14:50 -05:00
parent de4189fee3
commit 4a104b4132
+6 -3
View File
@@ -7,11 +7,14 @@
# Then in the sbt console:
# run
if [[ "${BASH_SOURCE[0]}" != "$0" ]]; then
>&2 echo "Fatal: lila.sh should be run, not sourced!"
return 1
fi
WARN() { >&2 printf '%s\n' "[warning] $*"; }
ABORT() { >&2 printf '%s\n' "[FATAL] $*"; exit 1; }
[[ "${BASH_SOURCE[0]}" == "$0" ]] || ABORT "should not be sourced!"
cd "$(dirname -- "$0")" # set cwd
cat << 'BANNER'
@@ -54,7 +57,7 @@ fi
java_bin="${java_home_bin:-$java_path_bin}"
if ! "$java_bin" --list-modules 2>/dev/null | grep -Fq jdk.compiler; then
WARN "$java_bin incomplete. Is it a JRE (and not a JDK)?"
WARN "$java_bin incomplete. Is it a JRE (and not a JDK)?"
fi
java_version=$("$java_bin" -version 2>&1 | head -n1 | cut -d'"' -f2)