robonix_api.spawn

Subprocess helper used by Capability.spawn(). Tracks every spawned PGID so Capability’s signal handler can SIGTERM all of them on shutdown.

Classes

SpawnRegistry()

Process-wide registry.

class robonix_api.spawn.SpawnRegistry[source]

Bases: object

Process-wide registry. One per Capability instance is fine.

shutdown_all(term_grace_s: float = 5.0) None[source]

SIGTERM every tracked PGID; SIGKILL anything that survives the grace period.

spawn(argv: Sequence[str], *, env: dict[str, str] | None = None, log_path: Path | None = None, cwd: Path | None = None) Popen[source]

Popen + start_new_session=True (own process group, easier cleanup) + optional stdout/stderr redirected to a file.