mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
fix: delegate the SIGINT signal of processes with orphan=true to their parent
This commit is contained in:
parent
bed8172347
commit
8962cbfe3e
1 changed files with 9 additions and 3 deletions
12
core/src/external/shell.rs
vendored
12
core/src/external/shell.rs
vendored
|
|
@ -30,7 +30,7 @@ impl ShellOpt {
|
||||||
|
|
||||||
pub fn shell(opt: ShellOpt) -> Result<Child> {
|
pub fn shell(opt: ShellOpt) -> Result<Child> {
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
return Ok(
|
return Ok(unsafe {
|
||||||
Command::new("sh")
|
Command::new("sh")
|
||||||
.arg("-c")
|
.arg("-c")
|
||||||
.stdin(opt.stdio())
|
.stdin(opt.stdio())
|
||||||
|
|
@ -40,8 +40,14 @@ pub fn shell(opt: ShellOpt) -> Result<Child> {
|
||||||
.arg("") // $0 is the command name
|
.arg("") // $0 is the command name
|
||||||
.args(opt.args)
|
.args(opt.args)
|
||||||
.kill_on_drop(!opt.orphan)
|
.kill_on_drop(!opt.orphan)
|
||||||
.spawn()?,
|
.pre_exec(move || {
|
||||||
);
|
if opt.orphan && libc::setpgid(0i32, 0i32) < 0 {
|
||||||
|
libc::perror(std::ptr::null());
|
||||||
|
}
|
||||||
|
Ok(())
|
||||||
|
})
|
||||||
|
.spawn()?
|
||||||
|
});
|
||||||
|
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue