Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1721 from Deradon/feature/file-storage_cache-with…
…-clean-on-exception Store::File#cache! will clean_cache! and retry after Errno::EMLINK
- Loading branch information
Showing
3 changed files
with
40 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
module FileUtilsHelper | ||
# NOTE: Make FileUtils.mkdir_p to raise `Errno::EMLINK` only once | ||
def fake_failed_mkdir_p | ||
original_mkdir_p = FileUtils.method(:mkdir_p) | ||
mkdir_p_called = false | ||
allow(FileUtils).to receive(:mkdir_p) do |args| | ||
if mkdir_p_called | ||
original_mkdir_p.call(*args) | ||
else | ||
mkdir_p_called = true | ||
raise Errno::EMLINK | ||
end | ||
end | ||
end | ||
end |