You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
On windows, direnv (even with an empty .envrc) attempts to upcase environment variables that it shouldn't be touching since they are not modified in the config;
And it produces the following errors, as in #1214, either when hooking into the shell or trying to source the output of direnv export pwsh:
Remove-Item: A positional parameter cannot be found that accepts argument 'SystemDrive'.
Remove-Item: A positional parameter cannot be found that accepts argument 'Path'.
Remove-Item: A positional parameter cannot be found that accepts argument 'ProgramFiles'.
Remove-Item: A positional parameter cannot be found that accepts argument 'CommonProgramFiles'.
Remove-Item: A positional parameter cannot be found that accepts argument 'ComSpec'.
Remove-Item: A positional parameter cannot be found that accepts argument 'SystemRoot'.
Remove-Item: A positional parameter cannot be found that accepts argument 'windir'
Isolating just the produced expression for the comspec variable, we get:
❯ cat .\comspec
Remove-Item -Path 'env:/'ComSpec''
T:\projects\test
❯ cat .\comspec|Invoke-Expression
Remove-Item: A positional parameter cannot be found that accepts argument 'ComSpec'.
To Reproduce
Create en empty directory with an empty .envrc. direnv allow on it and run direnv export pwsh (same happens if the hook is added to the profile startup script).
Expected behavior
I would expect environment variables that are not modified via .envrc (or .env if .envrc loads that) to not be touched.
Environment
OS: Windows 11
Shell: powershell 7.4.2
Direnv version: 2.34.0
Bash version 5.2.15(1)
Additional context direnv.toml has bash set to C:\Program Files\Git\usr\bin\bash.exe, which is installed by git to avoid using the wsl bash and the error from #1214.
I haven't looked in the code yet but I suspect this is somehow related to the interaction with mingw64 bash. likely a diff between the environment as shown by env in bash (that has environment variables upcased) and the environment as seen by powershell produces this effect. No clue what causes the malformed expressions themselves (i.e. that produce an error).
The text was updated successfully, but these errors were encountered:
Describe the bug
On windows, direnv (even with an empty .envrc) attempts to upcase environment variables that it shouldn't be touching since they are not modified in the config;
Furthetmore, it appears that the expression that direnv produces for powershell is malformed. Note the double single quotes:
And it produces the following errors, as in #1214, either when hooking into the shell or trying to source the output of
direnv export pwsh
:Isolating just the produced expression for the comspec variable, we get:
To Reproduce
Create en empty directory with an empty
.envrc
.direnv allow
on it and rundirenv export pwsh
(same happens if the hook is added to the profile startup script).Expected behavior
I would expect environment variables that are not modified via
.envrc
(or.env
if.envrc
loads that) to not be touched.Environment
Additional context
direnv.toml
has bash set toC:\Program Files\Git\usr\bin\bash.exe
, which is installed by git to avoid using the wsl bash and the error from #1214.I haven't looked in the code yet but I suspect this is somehow related to the interaction with mingw64 bash. likely a diff between the environment as shown by
env
in bash (that has environment variables upcased) and the environment as seen by powershell produces this effect. No clue what causes the malformed expressions themselves (i.e. that produce an error).The text was updated successfully, but these errors were encountered: