summaryrefslogtreecommitdiff
path: root/lib/ohai/plugins/java.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ohai/plugins/java.rb')
-rw-r--r--lib/ohai/plugins/java.rb10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/ohai/plugins/java.rb b/lib/ohai/plugins/java.rb
index b7cfab1f..a6777e78 100644
--- a/lib/ohai/plugins/java.rb
+++ b/lib/ohai/plugins/java.rb
@@ -19,17 +19,17 @@
require_plugin "languages"
java = Mash.new
-status = popen4("java -version") do |pid, stdin, stdout, stderr|
- stdin.close
- stderr.each do |line|
+
+status, stdout, stderr = run_command(:no_status_check => true, :command => "java -version")
+
+if status == 0
+ stderr.split("\n").each do |line|
case line
when /java version \"([0-9\.\_]+)\"/: java[:version] = $1
when /^(.+Runtime Environment.*) \(build (.+)\)$/: java[:runtime] = { "name" => $1, "build" => $2 }
when /^(.+ Client VM) \(build (.+)\)$/: java[:hotspot] = { "name" => $1, "build" => $2 }
end
end
-end
-if status == 0
languages[:java] = java if java[:version]
end