[JavaRequirement#satisfies_version] java_version_s: Fix regular expression.
The match obtained by applying the regular expression used to index into the `stderr` member of the result of calling `system_command` in the relevant variable assignment could yield unexpected results. The regular expression in- volved was not strict enough and contained an unescaped period, which could match any character, not just the expected literal decimal point. This commit corrects this oversight by escaping the relevant character, thus addressing @apjanke's remark in https://github.com/Homebrew/brew/pull/5280#issuecomment-437165119 on the existence of a: > …possible bug - that `.` looks like it should be escaped as `\.` to match a > literal ".".) …
This commit is contained in:
parent
a4eaae367b
commit
33c3faa125
@ -129,7 +129,7 @@ class JavaRequirement < Requirement
|
||||
end
|
||||
|
||||
def satisfies_version(java)
|
||||
java_version_s = system_command(java, args: ["-version"], print_stderr: false).stderr[/\d+.\d/]
|
||||
java_version_s = system_command(java, args: ["-version"], print_stderr: false).stderr[/\d+\.\d/]
|
||||
return false unless java_version_s
|
||||
|
||||
java_version = Version.create(java_version_s)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user