(
&self,
execution_context: &ExecutionContext,
instruments_env: HashMap<String, String>,
)
| 41 | } |
| 42 | |
| 43 | fn bench_cmd( |
| 44 | &self, |
| 45 | execution_context: &ExecutionContext, |
| 46 | instruments_env: HashMap<String, String>, |
| 47 | ) -> Result<(NamedTempFile, NamedTempFile, CommandBuilder)> { |
| 48 | let config = &execution_context.config; |
| 49 | let mut extra_env = |
| 50 | get_base_injected_env(self.mode.clone(), &execution_context.profile_folder, config); |
| 51 | extra_env.insert("PATH".into(), build_path_env(config.enable_introspection)?); |
| 52 | extra_env.extend(instruments_env); |
| 53 | |
| 54 | // Written to a script to keep the command's formatting without escaping it. |
| 55 | let mut script_file = NamedTempFile::new()?; |
| 56 | script_file.write_all(get_bench_command(config)?.as_bytes())?; |
| 57 | |
| 58 | let mut bench_cmd = CommandBuilder::new("bash"); |
| 59 | bench_cmd.arg(script_file.path()); |
| 60 | let (mut bench_cmd, env_file) = wrap_with_env(bench_cmd, &extra_env)?; |
| 61 | |
| 62 | if let Some(cwd) = &config.working_directory { |
| 63 | bench_cmd.current_dir(canonicalize(cwd)?); |
| 64 | } |
| 65 | |
| 66 | Ok((env_file, script_file, bench_cmd)) |
| 67 | } |
| 68 | } |
| 69 | |
| 70 | #[async_trait(?Send)] |
no test coverage detected