mirror of
https://github.com/openai/codex.git
synced 2026-12-01 00:20:48 +00:00
## Why Passing extra descriptors to a PTY previously selected behavior intended for inherited escalation sockets: no EOF on stdin close, different signal exit statuses, and no default `SHELL`. Launch attachments need ordinary PTY behavior and must survive execution even when marked `FD_CLOEXEC`. ## What changed - Add `ChildFds::Attached` alongside `ChildFds::Inherited` to distinguish launch attachments from legacy inherited descriptors. - Preserve ordinary EOF, default `SHELL`, and signal exit status behavior for PTY attachments. - Allow explicitly supplied close-on-exec descriptors through pipe and PTY launches without changing the parent's descriptor flags, using child-side flag updates and macOS spawn inheritance actions. - Update existing callers to use `ChildFds::Inherited`. ## Testing Add Unix coverage for attachment accessibility, unchanged parent descriptor flags, default `SHELL`, and signal exit statuses. Extend the PTY stdin-draining test to cover attachments and EOF delivery. GitOrigin-RevId: 864aedc6c5717d8b43c9d71057c9f54409834509
71 lines
2.4 KiB
Rust
71 lines
2.4 KiB
Rust
mod child;
|
|
pub use child::Child;
|
|
mod child_command;
|
|
pub use child_command::ChildStdin;
|
|
pub use child_command::Command;
|
|
pub use child_command::DescriptorPolicy;
|
|
pub use child_command::ProcessMode;
|
|
pub use child_command::SpawnFallback;
|
|
#[cfg(target_os = "linux")]
|
|
mod linux_fds;
|
|
pub mod pipe;
|
|
mod process;
|
|
pub mod process_group;
|
|
pub mod pty;
|
|
pub use pty::ChildFds;
|
|
#[cfg(test)]
|
|
mod tests;
|
|
#[cfg(unix)]
|
|
mod unix_io;
|
|
#[cfg(windows)]
|
|
mod win;
|
|
#[cfg(windows)]
|
|
mod windows_input;
|
|
|
|
pub const DEFAULT_OUTPUT_BYTES_CAP: usize = 1024 * 1024;
|
|
|
|
/// Spawn a non-interactive process using regular pipes for stdin/stdout/stderr.
|
|
pub use pipe::spawn_process as spawn_pipe_process;
|
|
/// Spawn a non-interactive process using regular pipes, but close stdin immediately.
|
|
pub use pipe::spawn_process_no_stdin as spawn_pipe_process_no_stdin;
|
|
/// Driver-backed process adapter used by integrations with their own process transport.
|
|
pub use process::ProcessDriver;
|
|
/// Handle for interacting with a spawned process (PTY or pipe).
|
|
pub use process::ProcessHandle;
|
|
/// Process signal supported by spawned-process handles.
|
|
pub use process::ProcessSignal;
|
|
/// Bundle of process handles plus split output and exit receivers returned by spawn helpers.
|
|
pub use process::SpawnedProcess;
|
|
/// Terminal size in character cells used for PTY spawn and resize operations.
|
|
pub use process::TerminalSize;
|
|
/// Combine stdout/stderr receivers into a single broadcast receiver.
|
|
pub use process::combine_output_receivers;
|
|
/// Adapt an externally-driven process into the standard spawned-process handle.
|
|
pub use process::spawn_from_driver;
|
|
/// Backwards-compatible alias for ProcessHandle.
|
|
pub type ExecCommandSession = ProcessHandle;
|
|
/// Backwards-compatible alias for SpawnedProcess.
|
|
pub type SpawnedPty = SpawnedProcess;
|
|
/// Report whether ConPTY is available on this platform (Windows only).
|
|
pub use pty::conpty_supported;
|
|
/// Spawn a process attached to a PTY for interactive use.
|
|
pub use pty::spawn_process as spawn_pty_process;
|
|
#[cfg(windows)]
|
|
pub use win::JobObject;
|
|
#[cfg(windows)]
|
|
pub use win::PsuedoCon;
|
|
#[cfg(windows)]
|
|
pub use win::conpty::RawConPty;
|
|
#[cfg(windows)]
|
|
pub use windows_input::WindowsTtyInputNormalizer;
|
|
|
|
#[cfg(target_os = "linux")]
|
|
mod spawn_helper;
|
|
#[cfg(target_os = "linux")]
|
|
mod spawn_helper_main;
|
|
#[cfg(target_os = "linux")]
|
|
pub use spawn_helper::init_spawn_helper;
|
|
#[cfg(all(test, target_os = "linux"))]
|
|
#[path = "spawn_helper_tests.rs"]
|
|
mod spawn_helper_tests;
|