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
commit16723afaa8df464aad242e11a0b69ab7f7a5c1bf (patch)
tree07a821081a210936f3b7209412b773032154703e /Library
parentbffe090b2100f8ef56be7f2e82a203083aff8c53 (diff)
downloadbrew-16723afaa8df464aad242e11a0b69ab7f7a5c1bf.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