Skip to main content

xtask_todo_lib/devshell/vm/
session_host.rs

1//! Host-only [`super::VmExecutionSession`]: same behavior as historical `sandbox::run_rust_tool` (temp export per command).
2
3use std::process::ExitStatus;
4
5use super::super::sandbox;
6use super::super::vfs::Vfs;
7use super::{VmError, VmExecutionSession};
8
9/// Runs `rustup`/`cargo` via temp directory export + sync (no persistent VM).
10#[derive(Debug, Default, Clone, Copy)]
11pub struct HostSandboxSession;
12
13impl HostSandboxSession {
14    #[must_use]
15    pub const fn new() -> Self {
16        Self
17    }
18}
19
20impl VmExecutionSession for HostSandboxSession {
21    fn run_rust_tool(
22        &mut self,
23        vfs: &mut Vfs,
24        vfs_cwd: &str,
25        program: &str,
26        args: &[String],
27    ) -> Result<ExitStatus, VmError> {
28        sandbox::run_rust_tool(vfs, vfs_cwd, program, args).map_err(VmError::Sandbox)
29    }
30}