Powershell: Delimit envrionment variable names when setting #1255
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is the simplest fix for the problem outlined in #1254: It just uses a brace pattern to delimit what the environment variable name key should be regardless of how
key
needs escaped. This lets it determine that the escape quotes are only for key instantiation.With this patch
cd
ing in and out of my project directory works exactly like I'd expect and has no errors.There might be another fix, like stripping unnecessary quoting, but this seems more robust and like it will work in more cases. I don't know how to write a test for this specific issue though since I'm unsure of how to minimize a Nix flake's output into
direnv
's test case definitions. If regression tests are wanted, help is appreciated please :)cc @bamsammich as the original PowerShell support implementer
Closes #1254