fix: make try init re-source safe through the shell wrapper - #140
Open
rohaquinlop wants to merge 1 commit into
Open
fix: make try init re-source safe through the shell wrapper#140rohaquinlop wants to merge 1 commit into
try init re-source safe through the shell wrapper#140rohaquinlop wants to merge 1 commit into
Conversation
The shell wrapper shadows the binary, so `try init` inside a sourced shell (e.g. `source ~/.zshrc` twice) fell through to the interactive selector instead of re-emitting the wrapper. Dispatch `init` in the `exec` path so re-init behaves like a plain `try init`. Adds shell-eval regression tests for bash and zsh covering `try exec init PATH` re-emitting the wrapper with the new path.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Route
try exec initto the init logic so re-runningtry initfrom a sourced shell re-emits the wrapper instead of opening the interactive selector.Why
The shell wrapper generated by
try initshadows thetrybinary. When a shell config is sourced again (source ~/.zshrc), thetry initline now resolves to the wrapper, which callstry exec— andexechad noinitcase, falling through to the interactive selector withinit <path>as the search query.Changes
try.rb: dispatchinitin theexecsubcommand path, mirroring plaintry initbehavior.spec/tests/test_36_shell_eval.sh: regression tests for bash and zsh assertingtry exec init PATHre-emits the wrapper with the new path.spec/init_spec.md: document re-sourcing safety.