Commit a23c21e9 by Jon Yurek

Unexpected system call errors don't cause rmdir'ing to fail

parent 4a05a8a5
...@@ -63,6 +63,9 @@ module Paperclip ...@@ -63,6 +63,9 @@ module Paperclip
end end
rescue Errno::ENOTEMPTY, Errno::ENOENT, Errno::EINVAL, Errno::ENOTDIR rescue Errno::ENOTEMPTY, Errno::ENOENT, Errno::EINVAL, Errno::ENOTDIR
# Stop trying to remove parent directories # Stop trying to remove parent directories
rescue SystemCallError => e
logger.info("[paperclip] There was an unexpected error while deleting directories: #{e.class}")
# Ignore it
end end
end end
@queued_for_delete = [] @queued_for_delete = []
......
...@@ -106,6 +106,10 @@ class IntegrationTest < Test::Unit::TestCase ...@@ -106,6 +106,10 @@ class IntegrationTest < Test::Unit::TestCase
assert ! File.exists?(File.dirname(@saved_path)) assert ! File.exists?(File.dirname(@saved_path))
assert ! File.exists?(File.dirname(File.dirname(@saved_path))) assert ! File.exists?(File.dirname(File.dirname(@saved_path)))
end end
before_should "not die if an unexpected SystemCallError happens" do
FileUtils.stubs(:rmdir).raises(Errno::EEXIST)
end
end end
end end
end end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment