aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/formula_lock.rb
diff options
context:
space:
mode:
authorMarkus Reiter2016-09-23 22:02:23 +0200
committerMarkus Reiter2016-09-24 12:24:35 +0200
commit58e36c73193befb57d351344cea2a4a33fef850d (patch)
tree3d26751835440341e5a42a189cf580e6253785df /Library/Homebrew/formula_lock.rb
parentbbc3f1c3a852e6cfd26a7a7c333092fae0520eb4 (diff)
downloadbrew-58e36c73193befb57d351344cea2a4a33fef850d.tar.bz2
Fix Style/GuardClause.
Diffstat (limited to 'Library/Homebrew/formula_lock.rb')
-rw-r--r--Library/Homebrew/formula_lock.rb12
1 files changed, 5 insertions, 7 deletions
diff --git a/Library/Homebrew/formula_lock.rb b/Library/Homebrew/formula_lock.rb
index 8743eaef8..4bd12df18 100644
--- a/Library/Homebrew/formula_lock.rb
+++ b/Library/Homebrew/formula_lock.rb
@@ -10,16 +10,14 @@ class FormulaLock
def lock
HOMEBREW_LOCK_DIR.mkpath
@lockfile = get_or_create_lockfile
- unless @lockfile.flock(File::LOCK_EX | File::LOCK_NB)
- raise OperationInProgressError, @name
- end
+ return if @lockfile.flock(File::LOCK_EX | File::LOCK_NB)
+ raise OperationInProgressError, @name
end
def unlock
- unless @lockfile.nil? || @lockfile.closed?
- @lockfile.flock(File::LOCK_UN)
- @lockfile.close
- end
+ return if @lockfile.nil? || @lockfile.closed?
+ @lockfile.flock(File::LOCK_UN)
+ @lockfile.close
end
def with_lock