Keg#lock: guard against nil in ensure

Fixes Homebrew/homebrew#17403.
This commit is contained in:
Jack Nagel 2013-01-29 10:25:07 -06:00
parent 9b555ee399
commit 61f01632c6

View File

@ -70,9 +70,11 @@ class Keg < Pathname
end
yield
ensure
unless file.nil?
file.flock(File::LOCK_UN)
file.close
end
end
def linked_keg_record
@linked_keg_record ||= HOMEBREW_REPOSITORY/"Library/LinkedKegs"/fname