File should be open in read/write mode. When doing lock on a file.
This commit is contained in:
parent
3b0f917b1d
commit
92537b8c27
@ -121,7 +121,7 @@ def delete_entry(key, options)
|
||||
# Lock a file for a block so only one process can modify it at a time.
|
||||
def lock_file(file_name, &block) # :nodoc:
|
||||
if File.exist?(file_name)
|
||||
File.open(file_name, 'r') do |f|
|
||||
File.open(file_name, 'r+') do |f|
|
||||
begin
|
||||
f.flock File::LOCK_EX
|
||||
yield
|
||||
|
Loading…
Reference in New Issue
Block a user