From 9a179d8b062eb4e148ae4f39375572ef3efaaa60 Mon Sep 17 00:00:00 2001 From: Jack Nagel Date: Sat, 26 Jan 2013 13:18:44 -0600 Subject: [PATCH] locks: ensure lock directory exists Fixes Homebrew/homebrew#17326. --- Library/Homebrew/formula.rb | 1 + Library/Homebrew/keg.rb | 1 + 2 files changed, 2 insertions(+) diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index 15ce8889c6..7af0989a74 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -229,6 +229,7 @@ class Formula end def lock + HOMEBREW_CACHE_FORMULA.mkpath lockpath = HOMEBREW_CACHE_FORMULA/"#{@name}.brewing" @lockfile = lockpath.open(File::RDWR | File::CREAT) unless @lockfile.flock(File::LOCK_EX | File::LOCK_NB) diff --git a/Library/Homebrew/keg.rb b/Library/Homebrew/keg.rb index 4949d24dc3..674ac881fa 100644 --- a/Library/Homebrew/keg.rb +++ b/Library/Homebrew/keg.rb @@ -62,6 +62,7 @@ class Keg < Pathname end def lock + HOMEBREW_CACHE_FORMULA.mkpath path = HOMEBREW_CACHE_FORMULA/"#{fname}.brewing" file = path.open(File::RDWR | File::CREAT) unless file.flock(File::LOCK_EX | File::LOCK_NB)