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

fix: harden orphan cleanup and lsregister fallback

This commit is contained in:
tw93
2026-03-08 15:29:25 +08:00
parent 50efe51565
commit 26b267c4a2
4 changed files with 77 additions and 1 deletions

View File

@@ -181,3 +181,21 @@ EOF
[ "$status" -eq 1 ]
[[ "$output" == *"Unknown action"* ]]
}
@test "opt_launch_services_rebuild handles missing lsregister without exiting" {
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"
get_lsregister_path() {
echo ""
return 0
}
opt_launch_services_rebuild
echo "survived"
EOF
[ "$status" -eq 0 ]
[[ "$output" == *"lsregister not found"* ]]
[[ "$output" == *"survived"* ]]
}