Return a proper error if terminal size fails

This commit is contained in:
Sharif Haason authored and David Peter committed 2022-09-11 21:45:06 +02:00
1 parent 41b3241718
commit 0565901fad
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
};