If you add commands to the current environment, zsh might not pick them up if it has already cached the resolved path of another location.
To reproduce
- Use zsh
- Have a locally installed JDK
- enable some bazel_env via direnv
which jstack --> should output the globally installed one
- Add
jstack to the bazel_env
which jstack --> still points to the global one, nothing changed
rehash
which jstack --> points to the bazel_env one
If you add commands to the current environment, zsh might not pick them up if it has already cached the resolved path of another location.
To reproduce
which jstack--> should output the globally installed onejstackto thebazel_envwhich jstack--> still points to the global one, nothing changedrehashwhich jstack--> points to the bazel_env one