Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
select-java: query java version using -XshowSettings
instead of parsing the output of `-version`, parse output of `-XshowSettings:properties`, whose format is more predicable. as on EL9, we have > Picked up JAVA_TOOL_OPTIONS: openjdk version "11.0.19" 2023-04-18 LTS OpenJDK Runtime Environment (Red_Hat-11.0.19.0.7-1.el9_1) (build 11.0.19+7-LTS) OpenJDK 64-Bit Server VM (Red_Hat-11.0.19.0.7-1.el9_1) (build 11.0.19+7-LTS, mixed mode, sharing) while on fedora 38, jre-1.8 prints > openjdk version "1.8.0_362" jre-11 prints > openjdk version "11.0.19" 2023-04-18 before this change, we just use `"` as the field separator for awk, this works, but the parsing algorithm is fragile. so let's use the "java.specification.version" property instead, it is always printed like > java.specification.version = 1.8 so, after this change, we split this line with " = ", and pick the last field, i.e., the value of `java.specification.version`. also, in this change, we are using the case clause for better readability. Fixes scylladb#212 Signed-off-by: Kefu Chai <kefu.chai@scylladb.com>
- Loading branch information