Permalink
Browse files

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

  • Loading branch information...
1 parent 4a05a8a commit a23c21e943aae1b46e7dbed3ffc9fcdd1f5d2fe6 @jyurek jyurek committed Feb 3, 2009
Showing with 7 additions and 0 deletions.
  1. +3 −0 lib/paperclip/storage.rb
  2. +4 −0 test/integration_test.rb
View
@@ -63,6 +63,9 @@ def flush_deletes #:nodoc:
end
rescue Errno::ENOTEMPTY, Errno::ENOENT, Errno::EINVAL, Errno::ENOTDIR
# 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
@queued_for_delete = []
View
@@ -106,6 +106,10 @@ class IntegrationTest < Test::Unit::TestCase
assert ! File.exists?(File.dirname(@saved_path))
assert ! File.exists?(File.dirname(File.dirname(@saved_path)))
end
+
+ before_should "not die if an unexpected SystemCallError happens" do
+ FileUtils.stubs(:rmdir).raises(Errno::EEXIST)
+ end
end
end
end

0 comments on commit a23c21e

Please sign in to comment.