Skip to content

fix: make tmp var global for EXIT trap access#13

Merged
davidristov merged 1 commit intomainfrom
fix/install-script
Mar 11, 2026
Merged

fix: make tmp var global for EXIT trap access#13
davidristov merged 1 commit intomainfrom
fix/install-script

Conversation

@davidristov
Copy link
Contributor

Running curl -fsSL https://raw.githubusercontent.com/exein-io/analyzer-cli/main/dist/install.sh | bash installs the CLI properly but fails with /tmp/analyzer-install.sh: line 1: tmp: unbound variable.

The issue is that tmp is being set as local variable in main but trap 'rm -rf "$tmp"' EXIT fires after main returns at which point tmp is out of scope. Combined with set -u we get the error above.

The fix is removing the declaration of tmp as a local variable, in which case bash treats it as a global one and it is accessible when the EXIT trap runs.

@davidristov davidristov requested a review from krsh March 10, 2026 00:16
@davidristov davidristov merged commit 1f578b2 into main Mar 11, 2026
4 checks passed
@davidristov davidristov deleted the fix/install-script branch March 11, 2026 13:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants