Return a proper error if terminal size fails

This commit is contained in:
Sharif Haason committed 2022-07-17 15:53:56 -04:00
1 parent ab381e88f8
commit cc9476d665
1 file changed
+1 -1
+1 -1
View File
@@ -329,7 +329,7 @@ fn run() -> Result<(), AnyhowError> {
{
Some(terminal_width)
} else if matches.is_present("auto_width") {
Some(terminal_size().expect("not a tty").0 .0)
Some(terminal_size().ok_or_else(|| anyhow!("not a TTY"))?.0 .0)
} else {
None
};