prettytable-rs icon indicating copy to clipboard operation
prettytable-rs copied to clipboard

TableSlice::print_tty() should not panic on I/O errors

Open koutheir opened this issue 3 years ago • 1 comments

Currently, TableSlice::print_tty() panics on I/O errors. I think it should return an error instead of panicking, because I/O errors are not exceptional situations. Panics are reserved to exceptional situations.

For example, failing to write to the standard output due to a broken pipe (EPIPE) is very common when commands are piped to head, tail, more, etc. The current behavior causes applications using this crate to panic when that happens, instead of simply exiting. See issue 16 in bingrep.

koutheir avatar Mar 16 '22 16:03 koutheir

Will need to switch this to is-terminal as we did with clap since atty has soundness issues in Windows. Need to check this panic as well.

pinkforest avatar Dec 27 '22 03:12 pinkforest