1
0
mirror of https://github.com/tw93/Mole.git synced 2026-02-04 17:24:45 +00:00

Implemented safer temp cleanup and error reporting while fixing folded-directory size fallback to prevent double counting and aligning Homebrew cleanup traps with safe removal.

This commit is contained in:
Tw93
2026-01-12 15:45:31 +08:00
parent 5d5056fc9e
commit 93dee7b94d
4 changed files with 57 additions and 7 deletions

View File

@@ -34,7 +34,7 @@ update_via_homebrew() {
temp_upgrade=$(mktemp_file "brew_upgrade")
# Set up trap for interruption (Ctrl+C) with inline cleanup
trap "stop_inline_spinner 2>/dev/null; rm -f \"$temp_update\" \"$temp_upgrade\" 2>/dev/null; echo \"\"; exit 130" INT TERM
trap 'stop_inline_spinner 2>/dev/null; safe_remove "$temp_update" true; safe_remove "$temp_upgrade" true; echo ""; exit 130' INT TERM
# Update Homebrew
if [[ -t 1 ]]; then
@@ -73,7 +73,8 @@ update_via_homebrew() {
trap - INT TERM
# Cleanup temp files
rm -f "$temp_update" "$temp_upgrade"
safe_remove "$temp_update" true
safe_remove "$temp_upgrade" true
if echo "$upgrade_output" | grep -q "already installed"; then
local installed_version