1
0
mirror of https://github.com/tw93/Mole.git synced 2026-03-22 19:40:07 +00:00

fix(clean): fix find -maxdepth position for BSD/macOS compatibility

On macOS (BSD find), -maxdepth must be placed before -name to work
correctly. When placed after, it was ignored causing find to scan
the entire home directory indefinitely on large directories.

Fixes #463
This commit is contained in:
tw93
2026-02-16 16:05:22 +08:00
parent a29cadbfd0
commit f21794d3d9

View File

@@ -162,8 +162,9 @@ clean_project_caches() {
flutter_tmp_file=$(create_temp_file)
local find_timeout=30
# Parallel scans (Next.js and __pycache__).
# Note: -maxdepth must come before -name for BSD find compatibility
(
command find -P "$HOME" -mount -type d -name ".next" -maxdepth 3 \
command find -P "$HOME" -maxdepth 3 -mount -type d -name ".next" \
-not -path "*/Library/*" \
-not -path "*/.Trash/*" \
-not -path "*/node_modules/*" \
@@ -172,7 +173,7 @@ clean_project_caches() {
) > "$nextjs_tmp_file" 2>&1 &
local next_pid=$!
(
command find -P "$HOME" -mount -type d -name "__pycache__" -maxdepth 3 \
command find -P "$HOME" -maxdepth 3 -mount -type d -name "__pycache__" \
-not -path "*/Library/*" \
-not -path "*/.Trash/*" \
-not -path "*/node_modules/*" \
@@ -181,7 +182,7 @@ clean_project_caches() {
) > "$pycache_tmp_file" 2>&1 &
local py_pid=$!
(
command find -P "$HOME" -mount -type d -name ".dart_tool" -maxdepth 5 \
command find -P "$HOME" -maxdepth 5 -mount -type d -name ".dart_tool" \
-not -path "*/Library/*" \
-not -path "*/.Trash/*" \
-not -path "*/node_modules/*" \