mirror of
https://github.com/tw93/Mole.git
synced 2026-03-24 17:30:09 +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:
@@ -162,8 +162,9 @@ clean_project_caches() {
|
|||||||
flutter_tmp_file=$(create_temp_file)
|
flutter_tmp_file=$(create_temp_file)
|
||||||
local find_timeout=30
|
local find_timeout=30
|
||||||
# Parallel scans (Next.js and __pycache__).
|
# 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 "*/Library/*" \
|
||||||
-not -path "*/.Trash/*" \
|
-not -path "*/.Trash/*" \
|
||||||
-not -path "*/node_modules/*" \
|
-not -path "*/node_modules/*" \
|
||||||
@@ -172,7 +173,7 @@ clean_project_caches() {
|
|||||||
) > "$nextjs_tmp_file" 2>&1 &
|
) > "$nextjs_tmp_file" 2>&1 &
|
||||||
local next_pid=$!
|
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 "*/Library/*" \
|
||||||
-not -path "*/.Trash/*" \
|
-not -path "*/.Trash/*" \
|
||||||
-not -path "*/node_modules/*" \
|
-not -path "*/node_modules/*" \
|
||||||
@@ -181,7 +182,7 @@ clean_project_caches() {
|
|||||||
) > "$pycache_tmp_file" 2>&1 &
|
) > "$pycache_tmp_file" 2>&1 &
|
||||||
local py_pid=$!
|
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 "*/Library/*" \
|
||||||
-not -path "*/.Trash/*" \
|
-not -path "*/.Trash/*" \
|
||||||
-not -path "*/node_modules/*" \
|
-not -path "*/node_modules/*" \
|
||||||
|
|||||||
Reference in New Issue
Block a user