mirror of
https://github.com/block/buzz.git
synced 2026-11-30 13:12:38 +00:00
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:
@@ -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())
|
||||
|
||||
Reference in New Issue
Block a user