aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorJack Nagel2013-04-27 15:21:05 -0500
committerJack Nagel2013-04-27 15:21:05 -0500
commite51d0e4d0c296d64c2a51a10af20263b90fff48e (patch)
treec015c8e802d6b204ada25ba4e72fcad287640f13 /Library
parent777473449bad0ecf8fc3e028fa3f1f18c7a0cff0 (diff)
downloadhomebrew-e51d0e4d0c296d64c2a51a10af20263b90fff48e.tar.bz2
Only remove DS_Store on ENOTEMPTY
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/extend/pathname.rb12
1 files changed, 6 insertions, 6 deletions
diff --git a/Library/Homebrew/extend/pathname.rb b/Library/Homebrew/extend/pathname.rb
index df8f3813e..ef7dcea99 100644
--- a/Library/Homebrew/extend/pathname.rb
+++ b/Library/Homebrew/extend/pathname.rb
@@ -141,14 +141,14 @@ class Pathname
def rmdir_if_possible
rmdir
true
- rescue SystemCallError => e
- # OK, maybe there was only a single `.DS_Store` file in that folder
- if (self/'.DS_Store').exist? && self.children.length == 1
- (self/'.DS_Store').unlink
+ rescue Errno::ENOTEMPTY
+ if (ds_store = self+'.DS_Store').exist? && children.length == 1
+ ds_store.unlink
retry
+ else
+ false
end
-
- raise unless e.errno == Errno::ENOTEMPTY::Errno or e.errno == Errno::EACCES::Errno or e.errno == Errno::ENOENT::Errno
+ rescue Errno::EACCES, Errno::ENOENT
false
end