(
command: &str,
cwd: &std::path::Path,
sandbox_status: &SandboxStatus,
create_dirs: bool,
)
| 180 | } |
| 181 | |
| 182 | fn 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 | |
| 209 | fn prepare_tokio_command( |
| 210 | command: &str, |
no test coverage detected