fix(desktop): detach install subprocesses from controlling terminal

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).
This commit is contained in:
Will Pfleger
2026-05-22 20:21:21 -04:00
parent 539ca457d5
commit d2b548627d

View File

@@ -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())