Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mutate arguments at std::process::Command #87379

Closed
3 of 5 tasks
cehteh opened this issue Jul 22, 2021 · 2 comments
Closed
3 of 5 tasks

Mutate arguments at std::process::Command #87379

cehteh opened this issue Jul 22, 2021 · 2 comments
Labels
C-tracking-issue Category: An issue tracking the progress of sth. like the implementation of an RFC T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.

Comments

@cehteh
Copy link

cehteh commented Jul 22, 2021

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

// 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

  • Implementation:
    • Unix Implementation
    • Other Platforms
  • Final comment period (FCP)
  • Stabilization PR

Unresolved Questions

  • None yet.
@cehteh cehteh added C-tracking-issue Category: An issue tracking the progress of sth. like the implementation of an RFC T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. labels Jul 22, 2021
cehteh added a commit to cehteh/rust that referenced this issue Jul 23, 2021
@cehteh
Copy link
Author

cehteh commented Jul 23, 2021

Working on this feature at:

https://github.com/cehteh/rust/tree/mutate_command_args

cehteh added a commit to cehteh/rust that referenced this issue Dec 8, 2021
@cehteh
Copy link
Author

cehteh commented Feb 28, 2023

closed in #87420

@ChrisDenton ChrisDenton closed this as not planned Won't fix, can't repro, duplicate, stale Feb 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-tracking-issue Category: An issue tracking the progress of sth. like the implementation of an RFC T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

2 participants