Skip to content

Commit c30c64f

Browse files
Fix install.sh trap: move tmpdir to global scope
The trap handler fired after main() returned, when the local tmpdir variable was out of scope. Use a global TMPDIR_CLEANUP variable instead. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0192twUPgNxmFCpvpsBk5uqg
1 parent 1c88223 commit c30c64f

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

‎install.sh‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,10 @@ install_skill() {
6565
echo "Skill installed to $SKILL_DIR/SKILL.md"
6666
}
6767

68+
TMPDIR_CLEANUP=""
69+
cleanup() { [ -n "$TMPDIR_CLEANUP" ] && rm -rf "$TMPDIR_CLEANUP"; }
70+
trap cleanup EXIT
71+
6872
main() {
6973
local os arch version version_bare download_url tmpdir
7074

@@ -83,7 +87,7 @@ main() {
8387
download_url="https://github.com/${REPO}/releases/download/${version}/cc-session-reader_${version_bare}_${os}_${arch}.tar.gz"
8488

8589
tmpdir="$(mktemp -d)"
86-
trap 'rm -rf "$tmpdir"' EXIT
90+
TMPDIR_CLEANUP="$tmpdir"
8791

8892
echo "Downloading cc-session-reader ${version} (${os}/${arch})..."
8993
curl -fsSL "$download_url" -o "$tmpdir/cc-session-reader.tar.gz"

0 commit comments

Comments
 (0)