diff options
Diffstat (limited to 'Library/Homebrew/formula_lock.rb')
| -rw-r--r-- | Library/Homebrew/formula_lock.rb | 15 | 
1 files changed, 6 insertions, 9 deletions
diff --git a/Library/Homebrew/formula_lock.rb b/Library/Homebrew/formula_lock.rb index 4bd12df18..bf747fea2 100644 --- a/Library/Homebrew/formula_lock.rb +++ b/Library/Homebrew/formula_lock.rb @@ -8,8 +8,8 @@ class FormulaLock    end    def lock -    HOMEBREW_LOCK_DIR.mkpath -    @lockfile = get_or_create_lockfile +    @path.parent.mkpath +    create_lockfile      return if @lockfile.flock(File::LOCK_EX | File::LOCK_NB)      raise OperationInProgressError, @name    end @@ -29,12 +29,9 @@ class FormulaLock    private -  def get_or_create_lockfile -    if @lockfile.nil? || @lockfile.closed? -      @lockfile = @path.open(File::RDWR | File::CREAT) -      @lockfile.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC) -    end - -    @lockfile +  def create_lockfile +    return unless @lockfile.nil? || @lockfile.closed? +    @lockfile = @path.open(File::RDWR | File::CREAT) +    @lockfile.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC)    end  end  | 
