mirror of
https://github.com/openai/codex.git
synced 2026-10-24 18:18:41 +00:00
## Why Terminating a Windows execution session must also stop child processes, while a normal root-process exit must continue to allow background descendants to run. ## What changed - Assign Windows pipe, ConPTY, and sandbox processes to job objects and terminate the job when a session is cancelled, times out, or is explicitly stopped. - Preserve descendants when the root process exits normally. - Attach ConPTY and sandbox processes to their jobs atomically at creation; keep root-process termination as a fallback where job setup is unavailable. ## Testing Added Windows coverage for descendant termination and preservation across pipe, ConPTY, capture, cancellation, and legacy sandbox execution paths. GitOrigin-RevId: 8f831f2fc4caaa7b79ce842a3ed7192bd02dd3b4
20 lines
490 B
Rust
20 lines
490 B
Rust
use super::*;
|
|
|
|
#[test]
|
|
fn process_fallback_terminates_root() -> anyhow::Result<()> {
|
|
let mut child = std::process::Command::new("ping.exe")
|
|
.args(["-n", "60", "127.0.0.1"])
|
|
.stdin(Stdio::null())
|
|
.stdout(Stdio::null())
|
|
.stderr(Stdio::null())
|
|
.spawn()?;
|
|
let mut terminator = PipeChildTerminator {
|
|
windows: WindowsChildTerminator::Process(child.id()),
|
|
};
|
|
|
|
terminator.kill()?;
|
|
|
|
assert!(!child.wait()?.success());
|
|
Ok(())
|
|
}
|