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>
pull/306/head
Manos Pitsidianakis 8 months ago
parent d3cbf184e6
commit e1b55340fa
No known key found for this signature in database
GPG Key ID: 7729C7707F7E09D0

@ -357,9 +357,11 @@ impl State {
} }
*/ */
let termsize = termion::terminal_size()?; let (cols, rows) = termion::terminal_size().chain_err_summary(|| {
let cols = termsize.0 as usize; "Could not determine terminal size. Are you running this on a tty? If yes, do you need \
let rows = termsize.1 as usize; permissions for tty ioctls?"
})?;
let (cols, rows) = (cols as usize, rows as usize);
let job_executor = Arc::new(JobExecutor::new(sender.clone())); let job_executor = Arc::new(JobExecutor::new(sender.clone()));
let accounts = { let accounts = {

Loading…
Cancel
Save