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

fix(purge): prevent hangs during size calculation

This commit is contained in:
tw93
2026-02-19 22:52:27 +08:00
parent 9de661b5df
commit 7c974bf351
2 changed files with 77 additions and 7 deletions

View File

@@ -492,6 +492,19 @@ EOF
[[ "$result" == "0" ]]
}
@test "get_dir_size_kb: returns TIMEOUT when size calculation hangs" {
mkdir -p "$HOME/www/stuck-project/node_modules"
result=$(bash -c "
source '$PROJECT_ROOT/lib/core/common.sh'
source '$PROJECT_ROOT/lib/clean/project.sh'
run_with_timeout() { return 124; }
get_dir_size_kb '$HOME/www/stuck-project/node_modules'
")
[[ "$result" == "TIMEOUT" ]]
}
@test "clean_project_artifacts: handles empty directory gracefully" {
run bash -c "
export HOME='$HOME'