Lands #5585, create the payloads.json on first use

bug/bundler_fix
HD Moore 2015-06-23 10:50:16 -07:00
commit 9cedb7dd7e
No known key found for this signature in database
GPG Key ID: 7549FB3DB1DD1F32
1 changed files with 1 additions and 3 deletions

View File

@ -16,8 +16,6 @@ class JSONHashFile
@lock = Mutex.new
@hash = {}
@last = 0
::FileUtils.mkdir_p(::File.dirname(path))
synced_update
end
def [](k)
@ -53,6 +51,7 @@ private
# Save the file, but prevent thread & process contention
def synced_update(&block)
@lock.synchronize do
::FileUtils.mkdir_p(::File.dirname(path))
::File.open(path, ::File::RDWR|::File::CREAT) do |fd|
fd.flock(::File::LOCK_EX)
@ -81,7 +80,6 @@ private
end
end
def parse_data(data)
return {} if data.to_s.strip.length == 0
begin