Repository navigation
fix hide-env, refactor: rename remove_env_var to hide_env_var for clarity and update related logic - #18170
Conversation
…rity and update related logic
f066e10 to
eef55a4
Compare
ce34843 to
dc87fdd
Compare
|
I'm fine with these changes but I think it makes the code harder to understand, other than the tests. These changes kind of stand out now since the rest of the file is |
|
@fdncred I've amended the first commit (just changed the order of functions) to make its diff easier to read. Aside from that, some of the existing tests weren't actually testing whether they got the error they were expecting. |
|
@Bahex I pushed a "fix" for the hide-env twice thing. Hopefully the CI goes green. Let me know if you have more input on the changes. |
|
Thinking more about this example: $env.myfoosymbol = "myfoosymbol"
do {
hide-env myfoosymbol
$env.myfoosymbol
}I think the outer scoped env var should be hidden. People don't really use |
|
Let's see if this CI goes green. I really don't care for the solution but I couldn't figure out other ways to accomplish this since it involves hiding envs in scope. |
Description
Fix
hide-envnot hiding variables after stack-level override$env.AAAA = "aaaa"; $env.AAAA = ""; hide-env AAAAfailed to hideAAAA. After the empty-string assignment,remove_env_varwould remove the stack entry and returntrue— but never mark the engine-state baseline as hidden, so$env.AAAAwas still accessible.Add a
Stack::hide_env_varmethod with full hiding semantics: removes the variable from the stack and marks the engine-state baseline as hidden inenv_hidden. The existingremove_env_varis preserved for callers that only need to clean up a stack-level value (e.g.FILE_PWD).User-facing changes (Release notes)
Fixes the issue where
$env.AAAA = "aaaa"; $env.AAAA = ""; hide-env AAAAfailed to hideAAAA. After the empty-string assignment.Additional notes
closes #18169