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:
- holding an optional
originatorlabel, - injecting
ORIGINATOR_ENV_VARinto every child the group spawns, - dispatching to either
crate::spawn()orcrate::spawn_daemon.
§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§
- Contained
Process Group - 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.