ZSH chpwd hook - #1583
Open
crpb wants to merge 1 commit into
Open
Conversation
Prevent execution of hook when triggered by any subprocesses like completion calls which can trigger a chpwd which will not change our cwd.
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.
Prevent execution of hook when triggered by any subprocesses like completion calls which can trigger a chpwd which will not change our cwd.
I ran into this problem when using
sshwhich evidently ran acdfor completing hostnames.The first call was with a hostname which can't be resolved, the second with a valid hostname.
The chpwd was triggered by the following line:
https://github.com/zsh-users/zsh/blob/40625a597581e8d3fd3dc8dc71a97d6e15c57242/Completion/Unix/Type/_ssh_hosts#L39
Changing the
cd $HOMEtocd -q $HOMEalready resolved the issue but i was told from the zsh-developers that the hook shouldn't be triggered by the shown calls and pointed me to https://github.com/zsh-users/zsh/blob/40625a597581e8d3fd3dc8dc71a97d6e15c57242/Functions/Chpwd/chpwd_recent_dirs#L32-L36 where i stole this test.