Skip to content

Commit 4cad10d

Browse files
committed
BazelQueryService handles bazel rc versions as well.
1 parent 85b5a40 commit 4cad10d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

cli/src/main/kotlin/com/bazel_diff/bazel/BazelQueryService.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ class BazelQueryService(
5353
if (result.output.size != 1 || !result.output.first().startsWith("bazel ")) {
5454
throw RuntimeException("Bazel version command returned unexpected output: ${result.output}")
5555
}
56-
// Trim off any prerelease suffixes.
56+
// Trim off any prerelease suffixes (e.g., 8.6.0-rc1 or 8.6.0rc1).
5757
val versionString = result.output.first().removePrefix("bazel ").trim().split('-')[0]
58-
val version = versionString.split('.').map { it.toInt() }.toTypedArray()
58+
val version = versionString.split('.').map { it.takeWhile { c -> c.isDigit() }.toInt() }.toTypedArray()
5959
return Triple(version[0], version[1], version[2])
6060
}
6161

0 commit comments

Comments
 (0)