forked from meli/meli
1
Fork 0

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 <manos@pitsidianak.is>
master
Manos Pitsidianakis 2023-09-25 09:50:56 +03:00
parent d3cbf184e6
commit e1b55340fa
Signed by: Manos Pitsidianakis
GPG Key ID: 7729C7707F7E09D0
1 changed files with 5 additions and 3 deletions

View File

@ -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 = {