1
1
mirror of https://github.com/mawww/kakoune.git synced 2024-11-24 07:53:41 +03:00

NCurses: Tolerate failure to open /dev/tty and to ioctl for resize

Not sure what to do when that happens, but asserting and quitting
is not necessarily the best option, try to tolerate it.

Fixes #1972
This commit is contained in:
Maxime Coste 2018-04-04 14:01:24 +10:00
parent 6ee60ff9d7
commit 2f799b1acf

View File

@ -475,12 +475,13 @@ void NCursesUI::check_resize(bool force)
resize_pending = 0;
const int fd = open("/dev/tty", O_RDWR);
if (fd < 0)
return;
auto close_fd = on_scope_end([fd]{ ::close(fd); });
winsize ws;
kak_assert(fd > -1);
winsize ws;
if (::ioctl(fd, TIOCGWINSZ, &ws) != 0)
kak_assert(false);
return;
const bool info = (bool)m_info;
const bool menu = (bool)m_menu;