MCPcopy Create free account
hub / github.com/CodSpeedHQ/codspeed / wrap_with

Method wrap_with

src/executor/helpers/command.rs:113–133  ·  view source on GitHub ↗
(&mut self, wrapper_cmd: CommandBuilder)

Source from the content-addressed store, hash-verified

111 }
112
113 pub fn wrap_with(&mut self, wrapper_cmd: CommandBuilder) -> &mut Self {
114 let mut new_argv = Vec::new();
115
116 // Add wrapper command arguments first
117 new_argv.extend(wrapper_cmd.argv.iter().cloned());
118
119 // Add the current program
120 new_argv.push(self.program.clone());
121
122 // Add the current arguments
123 new_argv.extend(self.argv.iter().cloned());
124
125 // Update program to wrapper and argv to the new argument list
126 self.program = wrapper_cmd.program;
127 self.argv = new_argv;
128 // Update cwd if wrapper has it set
129 self.cwd = wrapper_cmd.cwd.or(self.cwd.take());
130 // Merge environment variables, with wrapper's envs taking precedence
131 self.envs.extend(wrapper_cmd.envs);
132 self
133 }
134
135 /// Returns the command line as a string for debugging/testing purposes
136 pub fn as_command_line(&self) -> String {

Callers 5

wrap_isolation_scopeFunction · 0.80
wrap_commandMethod · 0.80
wrap_commandMethod · 0.80
test_wrap_with_builderFunction · 0.80

Calls

no outgoing calls

Tested by 2

test_wrap_with_builderFunction · 0.64