`Command::env` doesn't report an error for keys with `=` in them
Open
@tbu- is already working on this.
Since Jun 13, 2024.
C-discussion
T-libs
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
fn main() {
println!(
"{:?}",
std::process::Command::new("printenv")
.arg("foo")
.env("foo=bar", "baz")
.output()
);
}
This has a stdout of bar=baz, so the foo key has value bar=baz.
Which isn't what I asked for in env, but what I asked for is invalid.
We probably shouldn't panic from a bad env call, but this program shouldn't be able to spawn without erroring.
I assume .env("foo=bar", "baz").env_remove("foo=bar") shouldn't error. (Also, not sure how non-unix platforms handle this, but this validation should presumably be platform-specific).
I'm not sure if this is a bug or just weird behavior.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.