aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
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