From 0565901fad850dc185ff8bad06417f62983f2ffa Mon Sep 17 00:00:00 2001 From: Sharif Haason Date: Sun, 17 Jul 2022 15:53:56 -0400 Subject: [PATCH] Return a proper error if terminal size fails --- src/bin/hexyl.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bin/hexyl.rs b/src/bin/hexyl.rs index 3440f96..6d84081 100644 --- a/src/bin/hexyl.rs +++ b/src/bin/hexyl.rs @@ -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 };