From e1b55340fa258a2a7b118fd18c11614fb2b5e173 Mon Sep 17 00:00:00 2001 From: Manos Pitsidianakis Date: Mon, 25 Sep 2023 09:50:56 +0300 Subject: [PATCH] state.rs: show error description when TIOCGWINSZ ioctl fails In some situations, we're not compatible with the terminal. Show an error with details when the terminal size request happens. Signed-off-by: Manos Pitsidianakis --- meli/src/state.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/meli/src/state.rs b/meli/src/state.rs index 2030e808..2c081def 100644 --- a/meli/src/state.rs +++ b/meli/src/state.rs @@ -357,9 +357,11 @@ impl State { } */ - let termsize = termion::terminal_size()?; - let cols = termsize.0 as usize; - let rows = termsize.1 as usize; + let (cols, rows) = termion::terminal_size().chain_err_summary(|| { + "Could not determine terminal size. Are you running this on a tty? If yes, do you need \ + permissions for tty ioctls?" + })?; + let (cols, rows) = (cols as usize, rows as usize); let job_executor = Arc::new(JobExecutor::new(sender.clone())); let accounts = {