mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
fix: detach background and orphan processes from the controlling terminal with setsid() (#2723)
This commit is contained in:
parent
ca96c5bd98
commit
db60951783
1 changed files with 1 additions and 1 deletions
|
|
@ -38,7 +38,7 @@ pub fn shell(opt: ShellOpt) -> Result<Child> {
|
||||||
.current_dir(opt.cwd)
|
.current_dir(opt.cwd)
|
||||||
.kill_on_drop(!opt.orphan)
|
.kill_on_drop(!opt.orphan)
|
||||||
.pre_exec(move || {
|
.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());
|
return Err(std::io::Error::last_os_error());
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue