mirror of
https://github.com/tw93/Mole.git
synced 2026-02-04 15:04:42 +00:00
fix(uninstall): resolve hang during brew uninstall by exposing output and ensuring sudo
This commit is contained in:
@@ -388,6 +388,8 @@ batch_uninstall_applications() {
|
||||
# Stop Launch Agents/Daemons before removal.
|
||||
local has_system_files="false"
|
||||
[[ -n "$system_files" ]] && has_system_files="true"
|
||||
|
||||
|
||||
stop_launch_services "$bundle_id" "$has_system_files"
|
||||
|
||||
# Remove from Login Items
|
||||
|
||||
@@ -174,13 +174,24 @@ brew_uninstall_cask() {
|
||||
debug_log "Attempting brew uninstall --cask $cask_name"
|
||||
|
||||
# Run uninstall with timeout (suppress hints/auto-update)
|
||||
debug_log "Attempting brew uninstall --cask $cask_name"
|
||||
|
||||
# Ensure we have sudo access if needed, to prevent brew from hanging on password prompt
|
||||
# Many brew casks need sudo to uninstall
|
||||
if ! sudo -n true 2> /dev/null; then
|
||||
# If we don't have sudo, try to get it (visibly)
|
||||
sudo -v
|
||||
fi
|
||||
|
||||
local uninstall_ok=false
|
||||
local output
|
||||
if output=$(HOMEBREW_NO_ENV_HINTS=1 HOMEBREW_NO_AUTO_UPDATE=1 NONINTERACTIVE=1 \
|
||||
run_with_timeout 120 brew uninstall --cask "$cask_name" 2>&1); then
|
||||
|
||||
# Run directly without output capture to allow user interaction/visibility
|
||||
# This avoids silence/hangs when brew asks for passwords or confirmation
|
||||
if HOMEBREW_NO_ENV_HINTS=1 HOMEBREW_NO_AUTO_UPDATE=1 NONINTERACTIVE=1 \
|
||||
brew uninstall --cask "$cask_name"; then
|
||||
uninstall_ok=true
|
||||
else
|
||||
debug_log "brew uninstall output: $output"
|
||||
debug_log "brew uninstall failed with exit code $?"
|
||||
fi
|
||||
|
||||
# Verify removal
|
||||
|
||||
Reference in New Issue
Block a user