diff options
author | Rein Henrichs <rein@puppetlabs.com> | 2010-08-24 14:22:35 -0700 |
---|---|---|
committer | Rein Henrichs <rein@puppetlabs.com> | 2010-08-24 14:23:56 -0700 |
commit | 3671c9fce6cd6bbedf206f9c1c3611468b7887da (patch) | |
tree | 59e6960d32581b6c948bead746ec1fd6ae6c9b98 | |
parent | fca886136ab103bba5aa851687f7f97a6b95f8bd (diff) | |
download | facter-3671c9fce6cd6bbedf206f9c1c3611468b7887da.tar.gz facter-3671c9fce6cd6bbedf206f9c1c3611468b7887da.tar.xz facter-3671c9fce6cd6bbedf206f9c1c3611468b7887da.zip |
[#4583] Refactor uptime to use Resolution.exec
Resolution.exec used to ensure that any shell errors are suppressed.
-rw-r--r-- | lib/facter/util/uptime.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/facter/util/uptime.rb b/lib/facter/util/uptime.rb index 6c60ace..9a59d30 100644 --- a/lib/facter/util/uptime.rb +++ b/lib/facter/util/uptime.rb @@ -19,19 +19,19 @@ module Facter::Util::Uptime private def self.uptime_proc_uptime - if output = `/bin/cat #{uptime_file} 2>/dev/null` and $?.success? + if output = Facter::Util::Resolution.exec("/bin/cat #{uptime_file} 2>/dev/null") output.chomp.split(" ").first.to_i end end def self.uptime_sysctl - if output = `#{uptime_sysctl_cmd} 2>/dev/null` and $?.success? + if output = Facter::Util::Resolution.exec("#{uptime_sysctl_cmd} 2>/dev/null") compute_uptime(Time.at(output.unpack('L').first)) end end def self.uptime_who_dash_b - if output = `#{uptime_who_cmd} 2>/dev/null` and $?.success? + if output = Facter::Util::Resolution.exec("#{uptime_who_cmd} 2>/dev/null") compute_uptime(Time.parse(output)) end end |