prettytable-rs
prettytable-rs copied to clipboard
TableSlice::print_tty() should not panic on I/O errors
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.
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.