1
0
mirror of https://github.com/tw93/Mole.git synced 2026-03-22 21:55:08 +00:00

fix: preserve interrupt semantics and restore purge traps

This commit is contained in:
tw93
2026-02-27 11:18:53 +08:00
parent 194fe871e5
commit a9433e4acd
5 changed files with 81 additions and 0 deletions

View File

@@ -110,6 +110,19 @@ teardown() {
[ "$status" -eq 0 ]
}
@test "safe_remove preserves interrupt exit codes" {
local test_file="$TEST_DIR/interrupt_file"
echo "test" > "$test_file"
run bash -c "
source '$PROJECT_ROOT/lib/core/common.sh'
rm() { return 130; }
safe_remove '$test_file' true
"
[ "$status" -eq 130 ]
[ -f "$test_file" ]
}
@test "safe_remove in silent mode suppresses error output" {
run bash -c "source '$PROJECT_ROOT/lib/core/common.sh'; safe_remove '/System/test' true 2>&1"
[ "$status" -eq 1 ]