Module process

Module process 

Source
Expand description

Process spawning and lifecycle management for Lambda simulation.

This module provides utilities for spawning and managing runtime and extension processes within the Lambda simulator. It handles:

  • Automatic injection of Lambda environment variables
  • PID registration for freeze/thaw simulation
  • RAII-based cleanup on drop
  • Stdio inheritance for demos and debugging

§Example

use lambda_simulator::{Simulator, FreezeMode};
use lambda_simulator::process::ProcessRole;

let simulator = Simulator::builder()
    .freeze_mode(FreezeMode::Process)
    .build()
    .await?;

// Spawn a runtime - PID automatically registered for freeze/thaw
// In tests, use env!("CARGO_BIN_EXE_<name>") for binary path resolution
let runtime = simulator.spawn_process(
    "/path/to/my_runtime",
    ProcessRole::Runtime,
)?;

// Spawn an extension
let extension = simulator.spawn_process(
    "/path/to/my_extension",
    ProcessRole::Extension,
)?;

// Processes are automatically cleaned up when dropped

Structs§

ManagedProcess
A managed child process with automatic cleanup on drop.
ProcessConfig
Configuration for spawning a managed process.

Enums§

ProcessError
Error type for process spawning operations.
ProcessRole
The role of a spawned process in the Lambda environment.