-
Notifications
You must be signed in to change notification settings - Fork 100
Fix install.sh sourced-invocation and stale template alias #448
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,10 +1,26 @@ | ||||||
| #!/usr/bin/env bash | ||||||
| set -euo pipefail | ||||||
|
|
||||||
| # Refuse sourced or non-bash invocation: zsh leaves BASH_SOURCE unset, misplacing the venv. | ||||||
| if [[ -z "${BASH_VERSION:-}" ]]; then | ||||||
| printf 'error: scripts/install.sh must be executed with bash, not sourced. Run: ./scripts/install.sh\n' >&2 | ||||||
|
||||||
| printf 'error: scripts/install.sh must be executed with bash, not sourced. Run: ./scripts/install.sh\n' >&2 | |
| printf 'error: scripts/install.sh must be run under bash (for example: ./scripts/install.sh), not under sh or zsh.\n' >&2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
set -euo pipefailruns before the sourced/non-bash guards. If a user sources this file in an interactive shell, their shell options can be modified (e.g., enabling-e/-u/pipefail) before the script returns, which is an observable side effect even though the script is refusing to run. Consider movingset -euo pipefailto after the guards, or saving/restoring the caller's shell options when sourced so refusal leaves the environment unchanged.