-
Notifications
You must be signed in to change notification settings - Fork 621
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
Direnv: unloading after every command #726
Comments
I have a very similar problem ; but it happens even without Environment
Problem still happens with oh-my-zsh and powerlevel10k completely disabled ; however it does not happen with a default bash shell. |
same problem here, just created #771 |
@a4z are you also on zsh and macOS? |
Can you give me these outputs:
|
sure,
btw, I remember something I did yesterday .. it was |
@zimbatm Hope this can help
direnv @ 2.27.0
direnv @ 2.20.0
|
Can you try to set |
Another thing that might have caused an issue is that the hook now traps for errors.
You might try to remove the traps around it like so: _direnv_hook() {
eval "$("/nix/store/9lmh6ryhdkxbi4w5cp730s24ksa14vs1-direnv-2.27.0/bin/direnv" export zsh)";
} |
thanks for the tips zimbatm ! I can do that tomorrow, today on a different machine, Linux, and here so far I do not have the problem (but have simpler direnvs here also) |
@zimbatm , that
shall/can I put this simply in my .zshrc ? Edit: Haven't found a way to put that into .zshrc so it works, when I just put it there, I end up with an empty shell window .... looks like something missing |
What that means is that one of the other commands in this list is interfering with direnv: precmd_functions=(_p9k_do_nothing _zsh_highlight_main__precmd_hook omz_termsupport_precmd asdf_update_java_home _direnv_hook iterm2_precmd _p9k_precmd) To debug that, try removing them one after the other until the problem goes away. |
this work so the rouble maker seems to be (now what do I need to put in my zshrc to remove that ?) |
@a4z This added by asdf-java, you probably have something like function absolute_dir_path {
local absolute_path
absolute_path="$( cd -P "$( dirname "$1" )" && pwd )"
echo "$absolute_path"
}
asdf_update_java_home() {
local java_path
java_path="$(asdf which java)"
if [[ -n "${java_path}" ]]; then
export JAVA_HOME
JAVA_HOME="$(dirname "$(absolute_dir_path "${java_path}")")"
fi
}
autoload -U add-zsh-hook
add-zsh-hook precmd asdf_update_java_home source: https://github.com/halcyon/asdf-java/blob/6936bdfb3c69b4cab86bc046dd046259f724e2e9/set-java-home.zsh @zimbatm my guess for the culprit is that |
Tracked it down to halcyon/asdf-java#51 ; I'll open an issue to be sure they are aware of this. |
awesome, thanks a lot for the help @wnkz ! I suggested already a fix for zsh, will do bash when I have the same problem on bash, now where the problem is know it's not a problem anymore |
As far as a temporary fix, I got it to stop by just exiting everywhere that direnv was (and was supposed to be) loaded with the problematic shell. Also, BTW starship showed that direnv had not, in fact, actually unloaded. |
direnv: unloading is displayed after every command I run in my shell. The environment is not unloaded.
Initialise pipenv environment with pipenv install --python=3.8
create .envrc with echo 'layout pipenv' > .envrc
direnv: error /home/marc/workspace/direnv_bug/.envrc is blocked. Run
direnv allow
to approve its contentdirenv: unloading
run direnv allow, environment is loaded, then unloading message appears.
$ direnv allow
direnv: loading ~/workspace/direnv_bug/.envrc
direnv: export +PIPENV_ACTIVE +VIRTUAL_ENV ~PATH
direnv: unloading
pipenv environment is still loaded
$ which python
/home/marc/.local/share/virtualenvs/direnv_bug-kkqpciCf/bin/python
direnv: unloading
Any command run with the environment loaded shows the same 'direnv: unloading' message.
Expected behavior
Don't expect to see the direnv: unloading message
Environment
Additional context
I've tried uninstalling and re-installing direnv, but still seeing the message
The text was updated successfully, but these errors were encountered: