Skip to content

armgit / codex

Public Imported from GitHub
0

Lightweight coding agent that runs in your terminal

Rust

Avoid setpgid for inherited stdio on macOS (#8691)

Denis Andrejew9ce6bbc43e2d
diff --git a/codex-rs/core/src/spawn.rs b/codex-rs/core/src/spawn.rs
index d738f12232..48c57c2cd6 100644
--- a/codex-rs/core/src/spawn.rs
+++ b/codex-rs/core/src/spawn.rs
@@ -66,10 +66,11 @@ pub(crate) async fn spawn_child_async(
#[cfg(unix)]
unsafe {
+ let set_process_group = matches!(stdio_policy, StdioPolicy::RedirectForShellTool);
#[cfg(target_os = "linux")]
let parent_pid = libc::getpid();
cmd.pre_exec(move || {
- if libc::setpgid(0, 0) == -1 {
+ if set_process_group && libc::setpgid(0, 0) == -1 {
return Err(std::io::Error::last_os_error());
}