(&mut self, wrapper: S, wrapper_args: I)
| 82 | } |
| 83 | |
| 84 | pub fn wrap<S, I, T>(&mut self, wrapper: S, wrapper_args: I) -> &mut Self |
| 85 | where |
| 86 | S: AsRef<OsStr>, |
| 87 | I: IntoIterator<Item = T>, |
| 88 | T: AsRef<OsStr>, |
| 89 | { |
| 90 | let mut new_argv = Vec::new(); |
| 91 | |
| 92 | // Add wrapper arguments first |
| 93 | for arg in wrapper_args { |
| 94 | new_argv.push(arg.as_ref().to_owned()); |
| 95 | } |
| 96 | |
| 97 | // Add the current program |
| 98 | new_argv.push(self.program.clone()); |
| 99 | |
| 100 | // Add the current arguments |
| 101 | new_argv.extend(self.argv.iter().cloned()); |
| 102 | |
| 103 | // Update program to wrapper and argv to the new argument list |
| 104 | self.program = wrapper.as_ref().to_owned(); |
| 105 | self.argv = new_argv; |
| 106 | self |
| 107 | } |
| 108 | |
| 109 | pub fn wrap_with(&mut self, wrapper_cmd: CommandBuilder) -> &mut Self { |
| 110 | let mut new_argv = Vec::new(); |
no outgoing calls