From d2b548627d1836b9c297e8919c3b11114cf73e8f Mon Sep 17 00:00:00 2001 From: Will Pfleger Date: Fri, 22 May 2026 20:21:21 -0400 Subject: [PATCH] fix(desktop): detach install subprocesses from controlling terminal MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Install scripts like Codex's install.sh explicitly open /dev/tty to prompt interactively ("Start Codex now? [y/N]"), bypassing our stdin(Stdio::null()). Call setsid() in pre_exec to create a new session without a controlling terminal, forcing the script's fallback to read from stdin (/dev/null → EOF → default answer). --- desktop/src-tauri/src/commands/agent_discovery.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/desktop/src-tauri/src/commands/agent_discovery.rs b/desktop/src-tauri/src/commands/agent_discovery.rs index 10d615d60c..7c27d73bc7 100644 --- a/desktop/src-tauri/src/commands/agent_discovery.rs +++ b/desktop/src-tauri/src/commands/agent_discovery.rs @@ -128,6 +128,20 @@ fn run_install_command(step: &str, command: &str) -> InstallStepResult { cmd.env("PATH", path); } + // Detach from the controlling terminal so install scripts that read from + // /dev/tty (e.g. Codex's "Start Codex now? [y/N]") fall back to stdin + // (which is /dev/null) instead of blocking forever. + #[cfg(unix)] + { + use std::os::unix::process::CommandExt; + unsafe { + cmd.pre_exec(|| { + libc::setsid(); + Ok(()) + }); + } + } + let mut child = match cmd .stdin(std::process::Stdio::null()) .stdout(std::process::Stdio::piped())