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

Safety and Reliability Improvements

This commit is contained in:
Tw93
2025-12-04 15:06:45 +08:00
parent 54bbbcce47
commit a92d352376
12 changed files with 137 additions and 96 deletions

View File

@@ -120,8 +120,13 @@ batch_uninstall_applications() {
[[ -z "$selected_app" ]] && continue
IFS='|' read -r _ app_path app_name bundle_id _ _ <<< "$selected_app"
# Check if app is running (use app path for precise matching)
if pgrep -f "$app_path" > /dev/null 2>&1; then
# Check if app is running using executable name from bundle
local exec_name=""
if [[ -e "$app_path/Contents/Info.plist" ]]; then
exec_name=$(defaults read "$app_path/Contents/Info.plist" CFBundleExecutable 2> /dev/null || echo "")
fi
local check_pattern="${exec_name:-$app_name}"
if pgrep -x "$check_pattern" > /dev/null 2>&1; then
running_apps+=("$app_name")
fi