From 43b5e920f727ce521a56c4a30d22be1aee2519fe Mon Sep 17 00:00:00 2001 From: Claudio Bley Date: Wed, 4 Dec 2024 12:35:30 +0100 Subject: [PATCH] Warn about problems determining bazel version Instead of exiting silently, inform the user about the problem and carry on. Do not require a Bazel executable up front so we are still able to generate a project. --- start | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/start b/start index 6262c7145..80e5bcd67 100755 --- a/start +++ b/start @@ -126,15 +126,22 @@ have () { check_bazel_version () { if ! have bazel; then # shellcheck disable=SC2016 - stderr 'Warning: cannot find `bazel` executable in $PATH' + stderr 'Warning: cannot find `bazel` executable in $PATH (skipping version check)' + return + fi + if ! actual_raw=$(bazel version | grep -E '^Build label:' | grep -Eo '[0-9.]+'); then + stderr 'Warning: cannot determine bazel version (skipping version check)' return fi - actual_raw=$(bazel version | grep -E '^Build label:' | grep -Eo '[0-9.]+') # shellcheck disable=SC2034 - IFS=. read -r actual_major actual_minor actual_patch <<-EOF + if ! IFS=. read -r actual_major actual_minor actual_patch <<-EOF ${actual_raw} EOF + then + stderr "Warning: cannot parse version from bazel output (skipping version check)" + return + fi expected_min="${MIN_BAZEL_MAJOR}.${MIN_BAZEL_MINOR}.0" expected_max="${MAX_BAZEL_MAJOR}.${MAX_BAZEL_MINOR}.x"