MCPcopy Create free account
hub / github.com/Louisym/MiniCC / prepare_command

Function prepare_command

rust/crates/runtime/src/bash.rs:182–207  ·  view source on GitHub ↗
(
    command: &str,
    cwd: &std::path::Path,
    sandbox_status: &SandboxStatus,
    create_dirs: bool,
)

Source from the content-addressed store, hash-verified

180}
181
182fn prepare_command(
183 command: &str,
184 cwd: &std::path::Path,
185 sandbox_status: &SandboxStatus,
186 create_dirs: bool,
187) -> Command {
188 if create_dirs {
189 prepare_sandbox_dirs(cwd);
190 }
191
192 if let Some(launcher) = build_linux_sandbox_command(command, cwd, sandbox_status) {
193 let mut prepared = Command::new(launcher.program);
194 prepared.args(launcher.args);
195 prepared.current_dir(cwd);
196 prepared.envs(launcher.env);
197 return prepared;
198 }
199
200 let mut prepared = Command::new("sh");
201 prepared.arg("-lc").arg(command).current_dir(cwd);
202 if sandbox_status.filesystem_active {
203 prepared.env("HOME", cwd.join(".sandbox-home"));
204 prepared.env("TMPDIR", cwd.join(".sandbox-tmp"));
205 }
206 prepared
207}
208
209fn prepare_tokio_command(
210 command: &str,

Callers 1

execute_bashFunction · 0.70

Calls 3

envMethod · 0.80
prepare_sandbox_dirsFunction · 0.70

Tested by

no test coverage detected