We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents a2a231c + 3141d4e commit 9cedb7dCopy full SHA for 9cedb7d
lib/rex/json_hash_file.rb
@@ -16,8 +16,6 @@ def initialize(path)
16
@lock = Mutex.new
17
@hash = {}
18
@last = 0
19
- ::FileUtils.mkdir_p(::File.dirname(path))
20
- synced_update
21
end
22
23
def [](k)
@@ -53,6 +51,7 @@ def clear
53
51
# Save the file, but prevent thread & process contention
54
52
def synced_update(&block)
55
@lock.synchronize do
+ ::FileUtils.mkdir_p(::File.dirname(path))
56
::File.open(path, ::File::RDWR|::File::CREAT) do |fd|
57
fd.flock(::File::LOCK_EX)
58
@@ -81,7 +80,6 @@ def synced_update(&block)
81
80
82
83
84
-
85
def parse_data(data)
86
return {} if data.to_s.strip.length == 0
87
begin
0 commit comments