atuin
atuin copied to clipboard
History listing crashes when piped to less
If history is listed and captured by a pager like less
, if the user doesn't jump to the "end" of the list (i.e. read all entries) and just quits, the following crash occurs:
❯ atuin -V
atuin 0.8.1
❯ RUST_BACKTRACE=full atuin history list | less
thread 'main' panicked at 'failed to flush tab writer: Os { code: 32, kind: BrokenPipe, message: "Broken pipe" }', src/command/history.rs:91:20
stack backtrace:
0: 0x557d914d96aa - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h7b351b19edc68675
1: 0x557d91150aec - core::fmt::write::hda66aa43d7efd443
2: 0x557d914ccc64 - std::io::Write::write_fmt::h3aebb987a9dbdcf6
3: 0x557d914d4535 - std::panicking::default_hook::{{closure}}::h7e02fcec43867ea3
4: 0x557d914d4f41 - std::panicking::rust_panic_with_hook::h88a969557601b593
5: 0x557d914d9a08 - std::panicking::begin_panic_handler::{{closure}}::ha092887707fea9e8
6: 0x557d914d9986 - std::sys_common::backtrace::__rust_end_short_backtrace::h79f139e7bde27ff0
7: 0x557d914d4892 - rust_begin_unwind
8: 0x557d90ec1a60 - core::panicking::panic_fmt::h0b501d90f307324b
9: 0x557d90ec1bd2 - core::result::unwrap_failed::h3a83ea19e383960f
10: 0x557d90f071fe - atuin::command::history::print_list::h7b3065bff9d2e44f
11: 0x557d90f4db59 - atuin::command::AtuinCmd::run::{{closure}}::h3172cb497216c146
12: 0x557d90ffb9f6 - <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::h46f447d3b8d5f137
13: 0x557d90f8be6f - atuin::main::h971bddc84f979ae6
14: 0x557d90ff1283 - std::sys_common::backtrace::__rust_begin_short_backtrace::hd188a932111e0905
15: 0x557d91005b74 - main
16: 0x7fcb088a6fd0 - <unknown>
17: 0x7fcb088a707d - __libc_start_main
18: 0x557d90edfad9 - _start
19: 0x0 - <unknown>
Yeah this makes sense. I wonder if we should just ignore io errors for this path?
Resolved in main
🙌 (or at least I could not replicate this)