summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMaxime Coste <mawww@kakoune.org>2018-04-04 14:01:24 +1000
committerMaxime Coste <mawww@kakoune.org>2018-04-04 14:01:24 +1000
commit2f799b1acfd18e048b5d03b721158fed9b64f7ba (patch)
treeb0e5d22df635ca9b8c98cdce248d3be789b4c92e /src
parent6ee60ff9d7a4b6d4ae872dac8f7c72e15f7dc616 (diff)
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
Diffstat (limited to 'src')
-rw-r--r--src/ncurses_ui.cc7
1 files 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;