diff options
author | Patrick J Cherry <patrick@bytemark.co.uk> | 2017-01-31 12:12:23 +0000 |
---|---|---|
committer | Patrick J Cherry <patrick@bytemark.co.uk> | 2017-01-31 12:12:23 +0000 |
commit | 659a651aa294c335e519b4c72bbd052b3199a793 (patch) | |
tree | a36a95dd652717624034c553bf18c7d66156ccf5 /lib/byteback/util.rb | |
parent | 38c89a9e32a67f96b40d756a5c356f8c31247ab9 (diff) |
First pass with rubocoprubocop
Diffstat (limited to 'lib/byteback/util.rb')
-rw-r--r-- | lib/byteback/util.rb | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/byteback/util.rb b/lib/byteback/util.rb index ebf5ca5..7678d81 100644 --- a/lib/byteback/util.rb +++ b/lib/byteback/util.rb @@ -15,7 +15,7 @@ module Byteback if File.exist? @@lockfile # check the lockfile is sane exist_pid = File.read(@@lockfile).to_i - if exist_pid > 1 && exist_pid < (File.read('/proc/sys/kernel/pid_max').to_i) + if exist_pid > 1 && exist_pid < File.read('/proc/sys/kernel/pid_max').to_i begin Process.getpgid(exist_pid) # if no exception, process is running, abort @@ -40,7 +40,7 @@ module Byteback lockfile.puts Process.pid end rescue => _ex - fatal("Failed to open lockfile - are you running as root?") + fatal('Failed to open lockfile - are you running as root?') end end @@ -51,7 +51,7 @@ module Byteback end def log_system(*args) - debug('system: ' + args.map { |a| / /.match(a) ? "\"#{a}\"" : a }.join(' ')) + debug('system: ' + args.map { |a| / / =~ a ? "\"#{a}\"" : a }.join(' ')) rd, wr = IO.pipe pid = fork if pid.nil? # child @@ -71,8 +71,7 @@ module Byteback %w(/bin/btrfs /sbin/btrfs).each do |path| return path if File.exist?(path) end - raise Errno::ENOENT, 'btrfs' + fail Errno::ENOENT, 'btrfs' end - end end |