This commit is contained in:
sxyazi 2024-02-03 01:08:50 +08:00
parent 5d786c8ec5
commit abcfd6cfcf
No known key found for this signature in database
2 changed files with 8 additions and 3 deletions

View file

@ -1,4 +1,5 @@
use tokio::sync::mpsc;
use tracing::error;
use yazi_shared::event::Cmd;
use crate::which::Which;
@ -21,8 +22,12 @@ impl TryFrom<Cmd> for Opt {
impl Which {
pub fn callback(&mut self, opt: impl TryInto<Opt>) {
if let Ok(opt) = opt.try_into() {
opt.tx.try_send(opt.idx).ok();
let Ok(opt) = opt.try_into() else {
return;
};
if opt.tx.try_send(opt.idx).is_err() {
error!("callback: send error");
}
}
}

View file

@ -49,7 +49,7 @@ impl Utils {
Layer::Which
));
Ok(rx.recv().await)
Ok(rx.recv().await.map(|idx| idx + 1))
})?,
)?;