1
1
mirror of https://github.com/wez/wezterm.git synced 2024-12-22 12:51:31 +03:00

mux: reduce kill/wait period for fish

This kill/wait was added to workaround fish being weird on macos.
This is accidentally exponential as the pty layer already loops,
so we don't need to also loop here.

refs: https://github.com/wez/wezterm/issues/774
This commit is contained in:
Wez Furlong 2021-05-21 23:33:51 -07:00
parent caed905626
commit 78424036f9

View File

@ -685,25 +685,13 @@ impl LocalPane {
}
}
fn bounded_kill_wait(child: &mut Box<dyn Child + 'static>) {
for attempt in 0..5 {
let _ = child.kill();
if attempt > 0 {
std::thread::sleep(std::time::Duration::from_millis(50));
}
if let Ok(Some(_)) = child.try_wait() {
break;
}
}
}
impl Drop for LocalPane {
fn drop(&mut self) {
// Avoid lingering zombies if we can, but don't block forever.
// <https://github.com/wez/wezterm/issues/558>
if let ProcessState::Running { child, .. } = &mut *self.process.borrow_mut() {
bounded_kill_wait(child);
let _ = child.kill();
let _ = child.try_wait();
}
}
}