brew-config: check whether java exists in PATH
For OS X, we will call `/usr/libexec/java_home` to exam whehter java is installed. Also rename the method to follow the same naming pattern of other similar methods. Closes Homebrew/homebrew#36187. Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
This commit is contained in:
parent
c60454a72f
commit
8fc3c4c8e9
@ -119,10 +119,14 @@ module Homebrew
|
||||
s
|
||||
end
|
||||
|
||||
def java_version
|
||||
def describe_java
|
||||
if which("java").nil? || !quiet_system("/usr/libexec/java_home --failfast")
|
||||
"N/A"
|
||||
else
|
||||
java = `java -version 2>&1`.lines.first.chomp
|
||||
java =~ /java version "(.+?)"/ ? $1 : java
|
||||
end
|
||||
end
|
||||
|
||||
def dump_verbose_config(f=$stdout)
|
||||
f.puts "HOMEBREW_VERSION: #{HOMEBREW_VERSION}"
|
||||
@ -145,6 +149,6 @@ module Homebrew
|
||||
f.puts "Perl: #{describe_perl}"
|
||||
f.puts "Python: #{describe_python}"
|
||||
f.puts "Ruby: #{describe_ruby}"
|
||||
f.puts "Java: #{java_version}"
|
||||
f.puts "Java: #{describe_java}"
|
||||
end
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user