Skip to content

Commit

Permalink
cask/artifact/moved: fix permission handling when removing directories
Browse files Browse the repository at this point in the history
  • Loading branch information
Bo98 committed Mar 15, 2024
1 parent a3e5e3f commit 6cd49c6
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions Library/Homebrew/cask/artifact/moved.rb
Original file line number Diff line number Diff line change
Expand Up @@ -181,14 +181,8 @@ def delete(target, force: false, successor: nil, command: nil, **_)
# If an app folder is deleted, macOS considers the app uninstalled and removes some data.
# Remove only the contents to handle this case.
target.children.each do |child|
if target.writable? && !force
child.rmtree
else
Utils.gain_permissions_remove(child, command:)
end
Utils.gain_permissions_remove(child, command:)

Check warning on line 184 in Library/Homebrew/cask/artifact/moved.rb

View check run for this annotation

Codecov / codecov/patch

Library/Homebrew/cask/artifact/moved.rb#L184

Added line #L184 was not covered by tests
end
elsif target.parent.writable? && !force
target.rmtree
else
Utils.gain_permissions_remove(target, command:)
end
Expand Down

0 comments on commit 6cd49c6

Please sign in to comment.