-
Notifications
You must be signed in to change notification settings - Fork 141
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix version parsing script #4095
Conversation
@@ -36,7 +36,7 @@ else | |||
setarch | |||
JAVA=$NG | |||
else | |||
version=$("$_java" -version 2>&1) | |||
version=$("$_java" --version) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For some reason, java --version
prints to stdout
and -version
to stderr
. The two-dash version appears to be the more consistent format as well.
|
||
# The Java version information we're parsing here looks something like this: | ||
# | ||
# openjdk 21.0.2 2024-01-16 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Previously, java -version
would - for some implementations - produce something like:
openjdk version "21.0.2" 2024-01-16
on the first line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Just one comment.
This PR applies some minor cleanup to the
checkJava
script's parsing ofjava --version
output. The new code will produce a correct error message for Java >= 11, and better handles slightly different formats of version data produced by different JVM implementations.Fixes #4059
Fixes #4061