fix: don't quit yazi when blocking child takes the TTY

This commit is contained in:
Alastair Scheuermann 2026-06-18 15:40:44 -06:00
parent 85132ff343
commit 73a0d7fc13
3 changed files with 16 additions and 9 deletions

View file

@ -49,7 +49,7 @@ impl<'a> EventSource<'a> {
// Stop waiting for events.
if wakeup_ready {
while read_complete(&*self.waker, &mut [0u8; 1024])? != 0 {}
return Err(io::Error::from(io::ErrorKind::UnexpectedEof));
return Err(io::Error::from(io::ErrorKind::ConnectionAborted));
}
// More input is ready.

View file

@ -33,6 +33,7 @@ impl EventStream {
}
// try_poll() already handles Interrupted, this is defensive.
Err(e) if e.kind() == io::ErrorKind::Interrupted => continue,
Err(e) if e.kind() == io::ErrorKind::ConnectionAborted => break,
Err(e) => {
tx.send(Err(e)).ok();
break;

View file

@ -97,16 +97,22 @@ impl Raterm {
let mut rx = self.stream.take().unwrap();
tokio::spawn(async move {
while let Some(Ok(event)) = rx.recv().await {
match event {
Event::Key(key) if key.kind != KeyEventKind::Press => continue,
Event::Mouse(mouse) if !YAZI.mgr.mouse_events.get().contains(mouse.kind.into()) => {
continue;
}
_ => yazi_shared::event::Event::Term(event).emit(),
loop {
match rx.recv().await {
Some(Ok(event)) => match event {
Event::Key(key) if key.kind != KeyEventKind::Press => continue,
Event::Mouse(mouse) if !YAZI.mgr.mouse_events.get().contains(mouse.kind.into()) => {
continue;
}
_ => yazi_shared::event::Event::Term(event).emit(),
},
Some(Err(_)) => {
AppProxy::quit(Default::default());
break;
},
None => break,
}
}
AppProxy::quit(Default::default());
});
}