File tree 1 file changed +5
-4
lines changed
1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change 16
16
Facter . add ( :java_version ) do
17
17
setcode do
18
18
if [ 'darwin' ] . include? Facter . value ( :kernel ) . downcase
19
- return nil unless Facter ::Core ::Execution . execute ( '/usr/libexec/java_home --failfast' , { on_fail : false } )
20
- else
21
- return nil unless Facter ::Core ::Execution . which ( 'java' )
19
+ if Facter ::Core ::Execution . execute ( '/usr/libexec/java_home --failfast' , { on_fail : false } )
20
+ version = Facter ::Core ::Execution . execute ( 'java -Xmx12m -version 2>&1' ) . lines . find { |line | line . include? ( 'version' ) }
21
+ end
22
+ elsif Facter ::Core ::Execution . which ( 'java' )
23
+ version = Facter ::Core ::Execution . execute ( 'java -Xmx12m -version 2>&1' ) . lines . find { |line | line . include? ( 'version' ) }
22
24
end
23
- version = Facter ::Core ::Execution . execute ( 'java -Xmx12m -version 2>&1' ) . lines . find { |line | line . include? ( 'version' ) }
24
25
version [ %r{\" (.*?)\" } , 1 ] if version
25
26
end
26
27
end
You can’t perform that action at this time.
0 commit comments