fix: respond to the SIGTERM signal even when Yazi is in the background and has passed control of the terminal to the spawned process (#797)

This commit is contained in:
三咲雅 · Misaki Masa 2024-03-13 23:26:17 +08:00 committed by GitHub
parent 457c2a5c06
commit 094d44e3ec
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 7 additions and 8 deletions

View file

@ -37,10 +37,14 @@ body:
label: "`yazi --debug` output"
description: Please do a `yazi --debug` and paste the output here.
value: |
<details>
<!-- Paste the output between the backticks below: -->
```sh
```
</details>
validations:
required: true
- type: textarea

View file

@ -1,5 +1,6 @@
cargo publish -p yazi-shared
cargo publish -p yazi-config
cargo publish -p yazi-proxy
cargo publish -p yazi-adaptor
cargo publish -p yazi-boot
cargo publish -p yazi-scheduler

View file

@ -55,17 +55,11 @@ impl Signals {
let tx = self.tx.clone();
Ok(tokio::spawn(async move {
while let Some(signal) = signals.next().await {
if HIDER.try_acquire().is_err() {
continue;
}
match signal {
SIGHUP | SIGTERM | SIGQUIT | SIGINT => {
if tx.send(Event::Quit(Default::default())).is_err() {
break;
}
tx.send(Event::Quit(Default::default())).ok();
}
SIGCONT => AppProxy::resume(),
SIGCONT if HIDER.try_acquire().is_ok() => AppProxy::resume(),
_ => {}
}
}