Open kolloch opened 3 months ago
We could just run rehash
in bazel run //:bazel_env
if we detect that we are running in zsh
. I don't have much experience with zsh
, would you be interested in sending a PR I could review?
I think that the bazel_env
command is executed in a subshell, and rehash
needs to be executed in the affected shell.
I do think that it probably has to be added to direnv in some way. Or maybe there already is a way via direnv.
Maybe similarly to what has been done for auto-complete here: https://github.com/direnv/direnv/issues/443#issuecomment-1992019782
I'll try to find a nice solution there.
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 onejstack
to thebazel_env
which jstack
--> still points to the global one, nothing changedrehash
which jstack
--> points to the bazel_env one