blob: 83ac87ce3172c6a1b8c74d732e8029e06b15a9b6 [file] [log] [blame]
diff --git a/tools/bazel b/tools/bazel
index 3a516f2..1d13dd1 100755
--- a/tools/bazel
+++ b/tools/bazel
@@ -12,20 +12,24 @@ bazel_version=$(
# enable config per each major version, i.e. bazel6, bazel7, bazel8, ...
config="--config=bazel${bazel_version%%.*}"
-declare -a startup_options=()
+declare -a args=()
while [ "$#" -gt 0 ]; do
option="$1"
if [[ "$option" = -* ]]; then
- startup_options+=( "$option" )
+ args+=( "$option" )
shift
else
break
fi
done
-command=$1 ; shift
+if [ "$#" -gt 0 ]; then
+ command="$1" ; shift
+ args+=( "$command" "$config" "$@" )
+elif [ "${#args[@]}" -eq 0 ]; then
+ # no startup options, no command
+ exec "$BAZEL_REAL"
+fi
-# N.B. using a default value if unset for `startup_options` is needed for compatiblity with Bash 3
-# which treats an empty array as unset
-exec "$BAZEL_REAL" "${startup_options[@]-}" "$command" "$config" "$@"
+exec "$BAZEL_REAL" "${args[@]}"