Skip to content

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

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.

No activity

Activity on this issue will appear here.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCT-libs-api[DEPRECATED; DO NOT USE]

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions