mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-21 23:01:05 +00:00
fix: suspend only when there is a parent process (#3008)
This commit is contained in:
parent
74bd98031e
commit
bfe12c8052
5 changed files with 15 additions and 10 deletions
10
Cargo.lock
generated
10
Cargo.lock
generated
|
|
@ -2026,9 +2026,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rand"
|
name = "rand"
|
||||||
version = "0.9.1"
|
version = "0.9.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9fbfd9d094a40bf3ae768db9361049ace4c0e04a4fd6b359518bd7b73a73dd97"
|
checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"rand_chacha 0.9.0",
|
"rand_chacha 0.9.0",
|
||||||
"rand_core 0.9.3",
|
"rand_core 0.9.3",
|
||||||
|
|
@ -2155,9 +2155,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "redox_syscall"
|
name = "redox_syscall"
|
||||||
version = "0.5.13"
|
version = "0.5.14"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0d04b7d0ee6b4a0207a0a7adb104d23ecb0b47d6beae7152d0fa34b692b29fd6"
|
checksum = "de3a5d9f0aba1dbcec1cc47f0ff94a4b778fe55bca98a6dfa92e4e094e57b1c4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 2.9.1",
|
"bitflags 2.9.1",
|
||||||
]
|
]
|
||||||
|
|
@ -2907,7 +2907,7 @@ version = "2.1.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "8b907da542cbced5261bd3256de1b3a1bf340a3d37f93425a07362a1d687de56"
|
checksum = "8b907da542cbced5261bd3256de1b3a1bf340a3d37f93425a07362a1d687de56"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"rand 0.9.1",
|
"rand 0.9.2",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|
|
||||||
|
|
@ -14,8 +14,10 @@ impl Actor for Suspend {
|
||||||
|
|
||||||
fn act(_: &mut Ctx, _: Self::Options) -> Result<Data> {
|
fn act(_: &mut Ctx, _: Self::Options) -> Result<Data> {
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
unsafe {
|
if !yazi_shared::session_leader() {
|
||||||
libc::raise(libc::SIGTSTP);
|
unsafe {
|
||||||
|
libc::raise(libc::SIGTSTP);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
succ!();
|
succ!();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ impl Actions {
|
||||||
writeln!(s, " WAYFIRE_SOCKET : {:?}", env::var_os("WAYFIRE_SOCKET"))?;
|
writeln!(s, " WAYFIRE_SOCKET : {:?}", env::var_os("WAYFIRE_SOCKET"))?;
|
||||||
|
|
||||||
writeln!(s, "\nSSH")?;
|
writeln!(s, "\nSSH")?;
|
||||||
writeln!(s, " shared.in_ssh_connection: {:?}", yazi_shared::in_ssh_connection())?;
|
writeln!(s, " shared.in_ssh_connection: {}", yazi_shared::in_ssh_connection())?;
|
||||||
|
|
||||||
writeln!(s, "\nWSL")?;
|
writeln!(s, "\nWSL")?;
|
||||||
writeln!(s, " WSL: {:?}", yazi_adapter::WSL)?;
|
writeln!(s, " WSL: {:?}", yazi_adapter::WSL)?;
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,8 @@ macro_rules! act {
|
||||||
(@impl $layer:ident : $name:ident, $cx:ident, $opt:ident) => {{
|
(@impl $layer:ident : $name:ident, $cx:ident, $opt:ident) => {{
|
||||||
$cx.level += 1;
|
$cx.level += 1;
|
||||||
let result = match act!(@pre $layer:$name, $cx, $opt) {
|
let result = match act!(@pre $layer:$name, $cx, $opt) {
|
||||||
None | Some(Ok(yazi_shared::event::Data::Boolean(false))) => <act!($layer:$name) as yazi_actor::Actor>::act($cx, $opt),
|
Some(Ok(yazi_shared::event::Data::Boolean(true))) => Err(anyhow::anyhow!("canceled on preflight")),
|
||||||
Some(Ok(_)) => Err(anyhow::anyhow!("canceled on preflight")),
|
None | Some(Ok(_)) => <act!($layer:$name) as yazi_actor::Actor>::act($cx, $opt),
|
||||||
Some(e @ Err(_)) => e,
|
Some(e @ Err(_)) => e,
|
||||||
};
|
};
|
||||||
$cx.level -= 1;
|
$cx.level -= 1;
|
||||||
|
|
|
||||||
|
|
@ -25,3 +25,6 @@ fn hostname_impl() -> Result<String, std::io::Error> {
|
||||||
.map_err(|_| std::io::Error::other("invalid hostname"))
|
.map_err(|_| std::io::Error::other("invalid hostname"))
|
||||||
.map(|s| s.to_owned())
|
.map(|s| s.to_owned())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(unix)]
|
||||||
|
pub fn session_leader() -> bool { unsafe { libc::getsid(0) == libc::getpid() } }
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue