mirror of
https://github.com/tw93/Mole.git
synced 2026-03-23 19:20:07 +00:00
fix(uninstall): show next-step prompt without post-cleanup delay
This commit is contained in:
@@ -735,32 +735,26 @@ batch_uninstall_applications() {
|
|||||||
print_summary_block "$title" "${summary_details[@]}"
|
print_summary_block "$title" "${summary_details[@]}"
|
||||||
printf '\n'
|
printf '\n'
|
||||||
|
|
||||||
# Auto-run brew autoremove if Homebrew casks were uninstalled
|
# Run non-critical post-cleanup tasks asynchronously so the next prompt appears immediately.
|
||||||
if [[ $brew_apps_removed -gt 0 ]]; then
|
# These tasks are best-effort and should not block interactive flow.
|
||||||
# Show spinner while checking for orphaned dependencies
|
if [[ $brew_apps_removed -gt 0 || ($success_count -gt 0 && ${#success_items[@]} -gt 0) ]]; then
|
||||||
if [[ -t 1 ]]; then
|
local -a post_success_items=("${success_items[@]}")
|
||||||
start_inline_spinner "Checking brew dependencies..."
|
local post_brew_apps_removed="$brew_apps_removed"
|
||||||
fi
|
|
||||||
|
|
||||||
local autoremove_output removed_count
|
|
||||||
autoremove_output=$(HOMEBREW_NO_ENV_HINTS=1 brew autoremove 2> /dev/null) || true
|
|
||||||
removed_count=$(printf '%s\n' "$autoremove_output" | grep -c "^Uninstalling" || true)
|
|
||||||
removed_count=${removed_count:-0}
|
|
||||||
|
|
||||||
if [[ -t 1 ]]; then
|
if [[ -t 1 ]]; then
|
||||||
stop_inline_spinner
|
echo -e "${GRAY}${ICON_LIST}${NC} Finalizing uninstall cleanup in background..."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $removed_count -gt 0 ]]; then
|
(
|
||||||
echo -e "${GREEN}${ICON_SUCCESS}${NC} Cleaned $removed_count orphaned brew dependencies"
|
if [[ "$post_brew_apps_removed" -gt 0 ]]; then
|
||||||
echo ""
|
HOMEBREW_NO_ENV_HINTS=1 brew autoremove > /dev/null 2>&1 || true
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
# Clean up Dock entries for uninstalled apps.
|
if [[ ${#post_success_items[@]} -gt 0 ]]; then
|
||||||
if [[ $success_count -gt 0 && ${#success_items[@]} -gt 0 ]]; then
|
remove_apps_from_dock "${post_success_items[@]}" 2> /dev/null || true
|
||||||
remove_apps_from_dock "${success_items[@]}" 2> /dev/null || true
|
refresh_launch_services_after_uninstall 2> /dev/null || true
|
||||||
refresh_launch_services_after_uninstall 2> /dev/null || true
|
fi
|
||||||
|
) > /dev/null 2>&1 &
|
||||||
fi
|
fi
|
||||||
|
|
||||||
_cleanup_sudo_keepalive
|
_cleanup_sudo_keepalive
|
||||||
|
|||||||
Reference in New Issue
Block a user