From db609517835cc56e25920fde60a9f9e91a8b0648 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=89=E5=92=B2=E9=9B=85=20=C2=B7=20Misaki=20Masa?= Date: Mon, 5 May 2025 16:11:25 +0800 Subject: [PATCH] fix: detach background and orphan processes from the controlling terminal with `setsid()` (#2723) --- 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(())