Skip to content
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

setup/bash: Handle pre-existing bash-preexec from other cli tools #126

Merged
merged 2 commits into from
Aug 5, 2024

Conversation

joshi4
Copy link
Contributor

@joshi4 joshi4 commented Aug 5, 2024

  • cmd/init: separate bash-preexec and savvy setup
  • setup/bash-hooks: Add funcs to only add shell hooks if required.

Savvy relies on bash-preexec.sh to setup pre_cmd and pre_exec hooks in
bash.

Users may rely on multiple other tools(atuin, starship, etc) that
install and setup bash-preexec.sh.

In such cases,  a user's bashrc may initialize bash-preexec before running: `eval $(savvy init
bash)`

In that case [bash-preexec.sh](https://github.com/getsavvyinc/savvy-cli/blob/8c6a834c5a140b83cc77c788e40738f510af7c12/cmd/setup/bash-preexec.sh#L52)
avoids duplicate inclusion and returns early.

As a result, none of Savvy's custom hooks are evaluated and user's get
an error messasge "not configured to use Savvy" when trying to
record/run runbooks.

This commit fixes the above issue by separating initializing
bash-preexec from adding savvy's shell hooks.

Fixes #118
@joshi4 joshi4 merged commit 3241f71 into main Aug 5, 2024
1 check passed
@joshi4 joshi4 deleted the sj/fix-bash-preexec-interference branch August 5, 2024 22:44
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.

1 participant