Skip to content
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

bug: envrc is ignored when terminal being opened for the first time #624

Closed
avoidik opened this issue Sep 29, 2023 · 3 comments
Closed

bug: envrc is ignored when terminal being opened for the first time #624

avoidik opened this issue Sep 29, 2023 · 3 comments

Comments

@avoidik
Copy link

avoidik commented Sep 29, 2023

Hello,

I would like to report the following issue. I have a central folder where all my projects are located, let's call it ~/projects, in this folder I have my .envrc file which was approved via direnv allow ., whenever I open a new vscode terminal from the ~/projects root folder the extension doesn't detect my .envrc. In attempt to troubleshoot this issue I added exec > >(tee "${HOME}/envrc.log") 2>&1 line at the top of my .envrc script, it seems it just wasn't kicking in when another terminal window has been opened, because the log file hasn't been created.

I have to step out of the folder and return back into it to be able to finally load it properly, like this:

$ echo $DIRENV_
$DIRENV_DIFF          $DIRENV_DIR           $DIRENV_FILE          $DIRENV_WARN_TIMEOUT  $DIRENV_WATCHES
$ pwd
/Users/user.name/projects
$ cd ..
direnv: unloading
$ cd projects
direnv: loading ~/projects/.envrc

Now the envrc.log has been created and my configuration has been changed according to my .envrc. I am activating custom virtualenv environment there as follows.

source "${HOME}/projects/.venv/bin/activate" || { echo "Error: unable to activate virtualenv"; exit 1; }

This is what I have in the vscode configuration file.

{
    "terminal.integrated.defaultProfile.osx": "bash",
    "terminal.integrated.profiles.osx": {
        "bash": {
            "path": "bash",
            "args": [
                "-l",
                "-i"
            ],
            "icon": "terminal-bash"
        }
    },
    "direnv.restart.automatic": true
}
@avoidik
Copy link
Author

avoidik commented Sep 29, 2023

probably related to #561

@mkhl
Copy link
Contributor

mkhl commented Sep 29, 2023

probably related to #561

Sure sounds like it. Have you tried the debugging steps and workaround from there?

@avoidik
Copy link
Author

avoidik commented Sep 29, 2023

I will close mine, with direnv reload as a workaround.

@avoidik avoidik closed this as completed Sep 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants