fix(test): use single-quoted trap for safer cleanup (PRI-823)

Defers $TEMP_DIR expansion to execution time and quotes the variable
inside the trap, protecting against paths with spaces.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Drew Ritter
2026-03-23 13:36:59 -07:00
committed by Drew Ritter
parent 97677b2b24
commit 2cbbd8ce88

View File

@@ -8,7 +8,7 @@ set -euo pipefail
PASS=0
FAIL=0
TEMP_DIR=$(mktemp -d)
trap "rm -rf $TEMP_DIR" EXIT
trap 'rm -rf "$TEMP_DIR"' EXIT
log_pass() { echo " PASS: $1"; PASS=$((PASS + 1)); }
log_fail() { echo " FAIL: $1"; FAIL=$((FAIL + 1)); }