Feature gate: `#![feature(mutate_command_args)]` This is a tracking issue for adding an API to mutate the arguments of std::process::Command. Discussed earlier in https://internals.rust-lang.org/t/lack-of-api-mutating-args-at-std-command/14908 ### Public API ```rust // std::process::Command pub fn args_clear(&mut self) -> &mut Command; pub fn arg_set<S>(&mut self, index: usize, value: S) -> &mut Command where S: AsRef<OsStr>; // maybe for convenience (same as .args_clear().args(new_args)): pub fn args_new<I, S>(&mut self, args: I) -> &mut Command where I: IntoIterator<Item = S>, S: AsRef<OsStr>; ``` `arg_set()` may panic when the index is out of range, only existing elements get replaced. ### Steps / History - [x] Implementation: - [x] Unix Implementation - [x] Other Platforms - [ ] Final comment period (FCP) - [ ] Stabilization PR <!-- Once the feature has gone through a few release cycles and there are no unresolved questions left, the feature might be ready for stabilization. If this feature didn't go through the RFC process, a final comment period (FCP) is always needed before stabilization. This works as follows: A library API team member can kick off the stabilization process, at which point the rfcbot will ask all the team members to verify they agree with stabilization. Once enough members agree and there are no concerns, the final comment period begins: this issue will be marked as such and will be listed in the next This Week in Rust newsletter. If no blocking concerns are raised in that period of 10 days, a stabilzation PR can be opened by anyone. --> ### Unresolved Questions <!-- Include any open questions that need to be answered before the feature can be stabilised. If multiple (unrelated) big questions come up, it can be a good idea to open a separate issue for each, to make it easier to keep track of the discussions. It's useful to link any relevant discussions and conclusions (whether on GitHub, Zulip, or the internals forum) here. --> - None yet.
Activity
implement `std::process::Command::args_clear()`
cehteh commentedon Jul 23, 2021
Working on this feature at:
https://github.com/cehteh/rust/tree/mutate_command_args
implement `std::process::Command::args_clear()`
cehteh commentedon Feb 28, 2023
closed in #87420