From 3ecef1cba661786057e93aae13650a1184195289 Mon Sep 17 00:00:00 2001 From: posidoni <89808617+posidoni@users.noreply.github.com> Date: Tue, 14 Jul 2026 20:40:36 +0400 Subject: [PATCH] fix: hoist nullglob bad-example trap to global scope EXIT traps set inside a subshell function don't fire under Bash 3.2 (macOS default), leaking the temp dir. Mirrors the fix already applied to the paired .good.sh. Closes #13. --- examples/bash/04-nullglob-empty-match.bad.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/examples/bash/04-nullglob-empty-match.bad.sh b/examples/bash/04-nullglob-empty-match.bad.sh index c349869..b045f1a 100755 --- a/examples/bash/04-nullglob-empty-match.bad.sh +++ b/examples/bash/04-nullglob-empty-match.bad.sh @@ -5,9 +5,10 @@ # expect-shellcheck: none set -euo pipefail +tmp=$(mktemp -d) +trap 'rm -rf "$tmp"' EXIT + main() ( - tmp=$(mktemp -d) - trap 'rm -rf "$tmp"' EXIT cd "$tmp" for file in *.txt; do