xtask-todo-lib 0.1.32

Todo workspace library and cargo devshell subcommand
Documentation
//! Host-only [`super::VmExecutionSession`]: same behavior as historical `sandbox::run_rust_tool` (temp export per command).

use std::process::ExitStatus;

use super::super::sandbox;
use super::super::vfs::Vfs;
use super::{VmError, VmExecutionSession};

/// Runs `rustup`/`cargo` via temp directory export + sync (no persistent VM).
#[derive(Debug, Default, Clone, Copy)]
pub struct HostSandboxSession;

impl HostSandboxSession {
    #[must_use]
    pub const fn new() -> Self {
        Self
    }
}

impl VmExecutionSession for HostSandboxSession {
    fn run_rust_tool(
        &mut self,
        vfs: &mut Vfs,
        vfs_cwd: &str,
        program: &str,
        args: &[String],
    ) -> Result<ExitStatus, VmError> {
        sandbox::run_rust_tool(vfs, vfs_cwd, program, args).map_err(VmError::Sandbox)
    }
}