summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheodore Nordsieck <theo@opscode.com>2013-09-10 09:49:05 -0700
committerTheodore Nordsieck <theo@opscode.com>2013-09-11 16:13:25 -0700
commit9a394c201f8758a3050bbf0c5e5261bb1b9665ef (patch)
treedac381dfd6e600b30141462302192dbb12467ff7
parent1c8651b16cb46a84dd01e06ad1c685635e7ae4cc (diff)
downloadohai-9a394c201f8758a3050bbf0c5e5261bb1b9665ef.tar.gz
Converted plugins/freebsd/uptime to Mixlib::ShellOut.
-rw-r--r--lib/ohai/plugins/freebsd/uptime.rb13
1 files changed, 5 insertions, 8 deletions
diff --git a/lib/ohai/plugins/freebsd/uptime.rb b/lib/ohai/plugins/freebsd/uptime.rb
index cd802ed0..db05656f 100644
--- a/lib/ohai/plugins/freebsd/uptime.rb
+++ b/lib/ohai/plugins/freebsd/uptime.rb
@@ -22,15 +22,12 @@ Ohai.plugin do
# kern.boottime: { sec = 1232765114, usec = 823118 } Fri Jan 23 18:45:14 2009
collect_data do
- popen4("#{ Ohai.abs_path( "/sbin/sysctl" )} kern.boottime") do |pid, stdin, stdout, stderr|
- stdin.close
- stdout.each do |line|
- if line =~ /kern.boottime:\D+(\d+)/
- uptime_seconds Time.new.to_i - $1.to_i
- uptime seconds_to_human(uptime_seconds)
- end
+ so = shell_out("#{ Ohai.abs_path( "/sbin/sysctl" )} kern.boottime")
+ so.stdout.lines do |line|
+ if line =~ /kern.boottime:\D+(\d+)/
+ uptime_seconds Time.new.to_i - $1.to_i
+ uptime seconds_to_human(uptime_seconds)
end
end
end
end
-