From: Igor Matuszewski Date: Tue, 22 Aug 2017 15:13:00 +0000 (+0200) Subject: Add `fn args_replace` and `fn get_program` to `ProcessBuilder` X-Git-Tag: archive/raspbian/0.35.0-2+rpi1~3^2^2^2^2^2^2^2~22^2~7^2~10^2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=c48e6daa41b41945d4c42950ddc179f05ef439ca;p=cargo.git Add `fn args_replace` and `fn get_program` to `ProcessBuilder` --- diff --git a/src/cargo/util/process_builder.rs b/src/cargo/util/process_builder.rs index 6386be9de..704275d8c 100644 --- a/src/cargo/util/process_builder.rs +++ b/src/cargo/util/process_builder.rs @@ -45,6 +45,13 @@ impl ProcessBuilder { self } + pub fn args_replace>(&mut self, arguments: &[T]) -> &mut ProcessBuilder { + self.args = arguments.iter().map(|t| { + t.as_ref().to_os_string() + }).collect(); + self + } + pub fn cwd>(&mut self, path: T) -> &mut ProcessBuilder { self.cwd = Some(path.as_ref().to_os_string()); self @@ -61,6 +68,10 @@ impl ProcessBuilder { self } + pub fn get_program(&self) -> &OsString { + &self.program + } + pub fn get_args(&self) -> &[OsString] { &self.args }