Method: ComputeUnit::Device#read_file
- Defined in:
- lib/compute_unit/device.rb
#read_file(path, default = nil) ⇒ Object
128 129 130 131 132 133 134 135 136 137 138 |
# File 'lib/compute_unit/device.rb', line 128 def read_file(path, default = nil) File.read(path).chomp rescue Errno::EINVAL, Errno::EPERM default rescue Errno::ENOENT logger.debug("File #{path} does not exist, using defaults") default rescue Errno::EACCES logger.fatal('run this command as root or with sudo, using default value') default end |