Skip to content

Commit

Permalink
There might be still a small chance that the file was deleted between…
Browse files Browse the repository at this point in the history
… checking it is readable and actually reading it
  • Loading branch information
Phan Le committed Apr 20, 2015
1 parent f09ca25 commit d4b98b1
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/sass/cache_stores/filesystem.rb
Expand Up @@ -17,12 +17,12 @@ def initialize(cache_location)
# @see Base#\_retrieve
def _retrieve(key, version, sha)
return unless File.readable?(path_to(key))
File.open(path_to(key), "rb") do |f|
if f.readline("\n").strip == version && f.readline("\n").strip == sha
return f.read
end
end
begin
File.open(path_to(key), "rb") do |f|
if f.readline("\n").strip == version && f.readline("\n").strip == sha
return f.read
end
end
File.unlink path_to(key)
rescue Errno::ENOENT
# Already deleted. Race condition?
Expand Down

0 comments on commit d4b98b1

Please sign in to comment.