Skip to main content

Module containment

Module containment 

Source
Expand description

Process group with originator-env injection that delegates to the two-mode crate::spawn() surface.

ContainedProcessGroup no longer carries OS-level containment state of its own (the new spawn builds a Job Object per-spawn on Windows and places each child in its own process group on Unix). The group’s responsibility is now scoped to:

§RUNNING_PROCESS_ORIGINATOR environment variable

When an originator is set on a ContainedProcessGroup, all spawned child processes inherit the environment variable RUNNING_PROCESS_ORIGINATOR with the format TOOL:PID, where:

  • TOOL is the originator name (e.g., "CLUD", "JUPYTER")
  • PID is the process ID of the parent that spawned the group

Example value: RUNNING_PROCESS_ORIGINATOR=CLUD:12345

§Purpose

This env var enables cross-process session discovery after crashes.

§Example

use running_process::{ContainedProcessGroup, SpawnStdio};

let group = ContainedProcessGroup::with_originator("CLUD").unwrap();
let mut cmd = std::process::Command::new("sleep");
cmd.arg("60");
let _child = group.spawn(&mut cmd, SpawnStdio::default()).unwrap();

Structs§

ContainedProcessGroup
A logical group of spawned processes that share an originator label.

Constants§

ORIGINATOR_ENV_VAR
The environment variable name injected into child processes for cross-process session discovery.