1
0
mirror of https://github.com/tw93/Mole.git synced 2026-02-17 14:23:54 +00:00

fix silent exit on permission denied during App State Cleanup (#440)

This commit is contained in:
NeedmeFordev
2026-02-11 11:40:34 +09:00
committed by GitHub
parent 5065c9cacb
commit 42893381e3
2 changed files with 19 additions and 2 deletions

View File

@@ -500,6 +500,23 @@ EOF
[[ "$output" == *"App saved states optimized"* ]]
}
@test "opt_saved_state_cleanup continues on permission denied (silent exit)" {
local state_dir="$HOME/Library/Saved Application State"
mkdir -p "$state_dir/com.example.old.savedState"
touch -t 202301010000 "$state_dir/com.example.old.savedState" 2>/dev/null || true
run env HOME="$HOME" PROJECT_ROOT="$PROJECT_ROOT" bash --noprofile --norc << 'EOF'
set -euo pipefail
source "$PROJECT_ROOT/lib/core/common.sh"
source "$PROJECT_ROOT/lib/optimize/tasks.sh"
safe_remove() { return 1; }
opt_saved_state_cleanup
EOF
[ "$status" -eq 0 ]
[[ "$output" == *"App saved states optimized"* ]]
}
@test "opt_cache_refresh cleans Quick Look cache" {
mkdir -p "$HOME/Library/Caches/com.apple.QuickLook.thumbnailcache"
touch "$HOME/Library/Caches/com.apple.QuickLook.thumbnailcache/test.db"