Add add'l rescue for Utils.gain_permissions_rmdir#21508
Conversation
|
Essentially we shouldn't exit with 1 when I added the rescue block to ensure that we don't exit 1 if the folder isn't empty, as this is expected behaviour, but it looks like maybe another error is being thrown in #21507 I can't replicate the error in the issue on I'm not sure what caused the errors to start occurring with the |
4bb7521 to
99b484c
Compare
|
Ok, in that case, let's just rescue the add'l error class. PR Updated. I'll continue to investigate what is causing these errors to surface now. (There's an add'l, unrelated type fix in this PR from my experiments.) Thanks for the elaboration and effort here, @bevanjkay |
There was a problem hiding this comment.
Pull request overview
This PR fixes a regression introduced in #21499 where brew uninstall --cask --zap would fail with a hard error when attempting to remove non-empty directories that require sudo permissions. The fix restores the previous behavior of gracefully skipping non-empty directories.
Changes:
- Added
.to_stoUser.currentingain_permissionsmethod for type safety - Added
ErrorDuringExecutionto the rescue clause inrecursive_rmdirto catch errors from sudo-based rmdir operations
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| Library/Homebrew/cask/utils.rb | Fixed type issue by explicitly converting User.current to string in chown command |
| Library/Homebrew/cask/artifact/abstract_uninstall.rb | Added rescue for ErrorDuringExecution to gracefully handle non-empty directory errors when using sudo |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
99b484c to
f7e0faf
Compare
f7e0faf to
ae110ca
Compare
brew lgtm(style, typechecking and tests) with your changes locally?Partial revert of #21499
Intended to resolve #21507