Skip to main content

Module process

Module process 

Source
Expand description

Unified process handle types for PTY and pipe backends.

This module provides abstractions for interacting with spawned processes regardless of whether they use a PTY or regular pipes.

Inspired by codex-rs PTY process handle patterns (Apache-2.0). Copyright 2025 OpenAI. See the repository THIRD-PARTY-NOTICES file for full attribution.

§Async-drop pattern

Drop cannot be async, but some cleanup requires async operations (e.g. asking a runtime to stop a process, removing a container, closing a network connection). The pattern borrowed from testcontainers-rs is to spin a dedicated thread inside Drop, create a temporary Tokio runtime on that thread, and block the Drop call until the future resolves. This is heavier than a true async drop, but it lets us bridge sync Drop into async cleanup without requiring nightly Rust.

Structs§

ProcessHandle
Handle for driving an interactive or non-interactive process.
PtyHandles
Optional PTY-specific handles that must be preserved.
SpawnedProcess
Return value from spawn helpers (PTY or pipe).

Traits§

ChildTerminator
Trait for process termination strategies.

Functions§

collect_output_until_exit
Collect output from a process until it exits or times out.

Type Aliases§

ExecCommandSession
Backwards-compatible alias for ProcessHandle.
SpawnedPty
Backwards-compatible alias for SpawnedProcess.