state.rs: show error description when TIOCGWINSZ ioctl fails
Tests / Test on ${{ matrix.build }} (linux-amd64, ubuntu-latest, stable, x86_64-unknown-linux-gnu) (pull_request) Successful in 10m48s Details
Tests / Test on ${{ matrix.build }} (linux-amd64, ubuntu-latest, stable, x86_64-unknown-linux-gnu) (push) Successful in 10m59s Details

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