lib/dcell/info_service.rb in dcell-0.13.0 vs lib/dcell/info_service.rb in dcell-0.14.0
- old
+ new
@@ -43,11 +43,11 @@
@cpu_speed = Float(model_name[3])
end
cores = cpu_info.scan(/core id\s+: \d+/).uniq.size
@cpu_count = cores > 0 ? cores : 1
- @distribution = `lsb_release -d`[/Description:\s+(.*)\s*$/, 1]
+ @distribution = discover_distribution
else
@cpu_type = @cpu_vendor = @cpu_speed = @cpu_count = nil
end
case RUBY_ENGINE
@@ -86,9 +86,14 @@
end
uptime = matches[1]
days_string = uptime[/^(\d+) days/, 1]
days_string ? Integer(days_string) : 0
+ end
+
+ def discover_distribution
+ `lsb_release -d`[/Description:\s+(.*)\s*$/, 1]
+ rescue Errno::ENOENT
end
def to_hash
uptime_string = `uptime`