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

Method wrap_with

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

Source from the content-addressed store, hash-verified

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