Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit ca62a97

Browse files
committedDec 8, 2021
Provide the windows implementation of args_clear() and arg_set()
1 parent 816e4ec commit ca62a97

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed
 

‎library/std/src/sys/windows/process.rs

+8
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,14 @@ impl Command {
208208
pub fn arg(&mut self, arg: &OsStr) {
209209
self.args.push(Arg::Regular(arg.to_os_string()))
210210
}
211+
pub fn args_clear(&mut self) {
212+
self.args.truncate(1);
213+
}
214+
pub fn arg_set(&mut self, index: usize, arg: &OsStr) {
215+
assert!(index >= 1, "Index must be >= 1");
216+
debug_assert!(index < self.args.len(), "Index out of range");
217+
self.args[index] = Arg::Regular(arg.to_os_string());
218+
}
211219
pub fn env_mut(&mut self) -> &mut CommandEnv {
212220
&mut self.env
213221
}

0 commit comments

Comments
 (0)
Please sign in to comment.