Skip to content

Commit

Permalink
extend/pathname: restore old rmtree behaviour
Browse files Browse the repository at this point in the history
  • Loading branch information
Bo98 committed May 17, 2024
1 parent 7452350 commit ddb0c39
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Library/Homebrew/extend/pathname.rb
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,17 @@ def stem
File.basename(self, extname)
end

# Like regular `rmtree`, except it never ignores errors.
#
# This was the default behaviour in Ruby 3.1 and earlier.
#
# @api public
sig { void }
def rmtree(**options)
FileUtils.rm_r(@path, **options)
nil
end

# I don't trust the children.length == 0 check particularly, not to mention
# it is slow to enumerate the whole directory just to see if it is empty,
# instead rely on good ol' libc and the filesystem
Expand Down

0 comments on commit ddb0c39

Please sign in to comment.