diff options
author | Theodore Nordsieck <theo@opscode.com> | 2013-09-09 16:27:12 -0700 |
---|---|---|
committer | Theodore Nordsieck <theo@opscode.com> | 2013-09-11 16:13:23 -0700 |
commit | 7a16a8af9201f41d2814e94bbfb09891330941d5 (patch) | |
tree | 0854330f738da29c7d6ae0460eb0bf03e31e1df5 | |
parent | 48abf40f1ec01a072c2a0021274f70270552f81d (diff) | |
download | ohai-7a16a8af9201f41d2814e94bbfb09891330941d5.tar.gz |
Converted plugins/solaris2/uptime to Mixlib::ShellOut.
-rw-r--r-- | lib/ohai/plugins/solaris2/uptime.rb | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/lib/ohai/plugins/solaris2/uptime.rb b/lib/ohai/plugins/solaris2/uptime.rb index 0bfcc0be..e44632b9 100644 --- a/lib/ohai/plugins/solaris2/uptime.rb +++ b/lib/ohai/plugins/solaris2/uptime.rb @@ -26,14 +26,12 @@ Ohai.plugin do # Example output: # $ who -b # . system boot Jul 9 17:51 - popen4('who -b') do |pid, stdin, stdout, stderr| - stdin.close - stdout.each do |line| - if line =~ /.* boot (.+)/ - uptime_seconds Time.now.to_i - DateTime.parse($1).strftime('%s').to_i - uptime seconds_to_human(uptime_seconds) - break - end + so = shell_out("who -b") + so.stdout.lines do |line| + if line =~ /.* boot (.+)/ + uptime_seconds Time.now.to_i - DateTime.parse($1).strftime('%s').to_i + uptime seconds_to_human(uptime_seconds) + break end end end |