From eab5148a758128a66ea8cdf61d1b5bf4db9996fe Mon Sep 17 00:00:00 2001 From: sxyazi Date: Mon, 5 May 2025 16:09:12 +0800 Subject: [PATCH] fix: detach background and orphan processes from the controlling terminal with `setsid()` --- yazi-scheduler/src/process/shell.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yazi-scheduler/src/process/shell.rs b/yazi-scheduler/src/process/shell.rs index 36505cad..1f9a4153 100644 --- a/yazi-scheduler/src/process/shell.rs +++ b/yazi-scheduler/src/process/shell.rs @@ -38,7 +38,7 @@ pub fn shell(opt: ShellOpt) -> Result { .current_dir(opt.cwd) .kill_on_drop(!opt.orphan) .pre_exec(move || { - if opt.orphan && libc::setpgid(0, 0) < 0 { + if (opt.piped || opt.orphan) && libc::setsid() < 0 { return Err(std::io::Error::last_os_error()); } Ok(())