mirror of
https://github.com/sharkdp/bat
synced 2026-06-09 10:03:18 +00:00
Fix panic in BuiltinPager drop when pager thread panics
The Drop impl for OutputType::BuiltinPager calls handle.take().unwrap().join().unwrap() which panics if the pager thread itself panicked. In Drop, this causes a double panic (abort). Replace with if-let and discard the join result, matching the pattern used for OutputType::Pager which also uses let _ =. Reported in #3449 where BAT_PAGER=builtin with --help causes the pager thread to fail. Fixes #3449
This commit is contained in:
+2
-2
@@ -225,8 +225,8 @@ impl Drop for OutputType {
|
||||
let _ = command.wait();
|
||||
}
|
||||
OutputType::BuiltinPager(ref mut pager) => {
|
||||
if pager.handle.is_some() {
|
||||
let _ = pager.handle.take().unwrap().join().unwrap();
|
||||
if let Some(handle) = pager.handle.take() {
|
||||
let _ = handle.join();
|
||||
}
|
||||
}
|
||||
OutputType::Stdout(_) => (),
|
||||
|
||||
Reference in New Issue
Block a user