From 6d66465447440229d3061a05a24be90323f1cb6c Mon Sep 17 00:00:00 2001 From: Tw93 Date: Tue, 23 Dec 2025 09:55:18 +0800 Subject: [PATCH] refactor: Improve shell array expansion robustness in cleanup functions --- lib/clean/project.sh | 10 +++++----- mole | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/clean/project.sh b/lib/clean/project.sh index d1100f9..a86dae0 100644 --- a/lib/clean/project.sh +++ b/lib/clean/project.sh @@ -413,11 +413,11 @@ clean_project_artifacts() { # shellcheck disable=SC2329 cleanup_scan() { # Kill all background scans - for pid in "${scan_pids[@]}"; do + for pid in "${scan_pids[@]+"${scan_pids[@]}"}"; do kill "$pid" 2> /dev/null || true done # Clean up temp files - for temp in "${scan_temps[@]}"; do + for temp in "${scan_temps[@]+"${scan_temps[@]}"}"; do rm -f "$temp" 2> /dev/null || true done if [[ -t 1 ]]; then @@ -450,7 +450,7 @@ clean_project_artifacts() { done # Wait for all scans to complete - for pid in "${scan_pids[@]}"; do + for pid in "${scan_pids[@]+"${scan_pids[@]}"}"; do wait "$pid" 2> /dev/null || true done @@ -459,7 +459,7 @@ clean_project_artifacts() { fi # Collect all results - for scan_output in "${scan_temps[@]}"; do + for scan_output in "${scan_temps[@]+"${scan_temps[@]}"}"; do if [[ -f "$scan_output" ]]; then while IFS= read -r item; do if [[ -n "$item" ]]; then @@ -564,7 +564,7 @@ clean_project_artifacts() { # Check if recent local is_recent=false - for recent_item in "${recently_modified[@]}"; do + for recent_item in "${recently_modified[@]+"${recently_modified[@]}"}"; do if [[ "$item" == "$recent_item" ]]; then is_recent=true break diff --git a/mole b/mole index 94de8c6..3248b8b 100755 --- a/mole +++ b/mole @@ -22,7 +22,7 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" source "$SCRIPT_DIR/lib/core/common.sh" # Version info -VERSION="1.14.2" +VERSION="1.14.3" MOLE_TAGLINE="Deep clean and optimize your Mac." # Check TouchID configuration