Skip to content

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

Closed as not planned
Closed as not planned
@cehteh

Description

@cehteh

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions