Repository navigation
tests: preserve environment overrides in WASI - #15150
Merged
Merged
Conversation
sylvestre
reviewed
Oct 7, 2026
| for (key, val) in &cmd_env { | ||
| // WASI reads the first duplicate, whereas Command::envs uses the last. | ||
| // Resolve overrides before forwarding them to the guest. | ||
| let wasm_env: BTreeMap<_, _> = cmd_env.iter().cloned().collect(); |
Contributor
There was a problem hiding this comment.
could be a map of refs, no? cmd_env.iter().map(|(k, v)| (k, v)).collect() avoids the clone
Contributor
Author
There was a problem hiding this comment.
done, thank you
Contributor
|
Thanks for your PR |
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.
The WASI test harness forwards duplicate environment variables when a test overrides a default or sets a variable more than once. This makes overrides behave differently from native commands.
Resolve duplicates before forwarding them to the guest, keeping the last value. A regression test covers both cases on native and WASI runs.
Split out of #15139 as requested in review.