From 2f799b1acfd18e048b5d03b721158fed9b64f7ba Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Wed, 4 Apr 2018 14:01:24 +1000 Subject: [PATCH] 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 --- src/ncurses_ui.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/ncurses_ui.cc b/src/ncurses_ui.cc index b6026e37..42023ebb 100644 --- a/src/ncurses_ui.cc +++ b/src/ncurses_ui.cc @@ -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;