Skip to content

Commit

Permalink
fix in case the unit is not uppercase (kB for kilobytes is an example)
Browse files Browse the repository at this point in the history
  • Loading branch information
Pat Collins committed Jan 8, 2013
1 parent abbe888 commit a53edb3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/ohai/plugins/darwin/memory.rb
Expand Up @@ -24,10 +24,10 @@
stdin.close stdin.close
stdout.each do |line| stdout.each do |line|
if line =~ /PhysMem:/ if line =~ /PhysMem:/
memory[:total] = "#{$1}#{$2}B" if line =~ /(\d+)([A-Z]{1})\s+used/ memory[:total] = "#{$1}#{$2}B" if line =~ /(\d+)([a-z]{1})\s+used/i
memory[:free] = "#{$1}#{$2}B" if line =~ /(\d+)([A-Z]{1})\s+free/ memory[:free] = "#{$1}#{$2}B" if line =~ /(\d+)([a-z]{1})\s+free/i
memory[:active] = "#{$1}#{$2}B" if line =~ /(\d+)([A-Z]{1})\s+active/ memory[:active] = "#{$1}#{$2}B" if line =~ /(\d+)([a-z]{1})\s+active/i
memory[:inactive] = "#{$1}#{$2}B" if line =~ /(\d+)([A-Z]{1})\s+inactive/ memory[:inactive] = "#{$1}#{$2}B" if line =~ /(\d+)([a-z]{1})\s+inactive/i
end end
end end
end end
Expand Down

0 comments on commit a53edb3

Please sign in to comment.