Improve with-env robustness#12523
Merged
WindSoilder merged 11 commits intonushell:mainfrom Apr 16, 2024
Merged
Conversation
This was previously ignored
`CantConvert` is probably not the most appropriate, but semantically we try to convert the mess to a record.
Same behavior as `$env.PROTECTED = ...` assignment evaluation or `load-env`
Record is more readable and explicit although slightly more work to generate in code than a list
`FOO=bar command` syntax gets desugared in the parser to a `with-env` call. Thus migrate to the recommended record form.
This was otherwise traversing the engine state for the definition of `with-env` even if it is not needed here. May improve performance slightly (if llvm did not come to the conclusion that this had no side-effects and could reorder)
Now disallowed ``` FOO=bar FOO=baz $env ```
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
Work for #7149
with-envgiven uneven count in list formwith-envCantConvertto recordwith-envwhen given protected env varswith-envUser-Facing Changes
Deprecation of the following forms
recommended standardized form
(Side effect) Repeated definitions in an env shorthand are now disallowed