From f9e4e71285899b5f8fd06f2e08c4f91b78e8f581 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 7 Oct 2019 20:48:31 +0530 Subject: [PATCH] Slightly better error message when opening controlling terminal fails --- kitty/data-types.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kitty/data-types.c b/kitty/data-types.c index 2d4e477b9..a5f4731b5 100644 --- a/kitty/data-types.c +++ b/kitty/data-types.c @@ -110,7 +110,7 @@ open_tty(PyObject *self UNUSED, PyObject *args) { if (!read_with_timeout) flags |= O_NONBLOCK; static char ctty[L_ctermid+1]; int fd = open(ctermid(ctty), flags); - if (fd == -1) { PyErr_SetFromErrno(PyExc_OSError); return NULL; } + if (fd == -1) { PyErr_Format(PyExc_OSError, "Failed to open controlling terminal: %s (identified with ctermid()) with error: %s", ctty, strerror(errno)); return NULL; } struct termios *termios_p = calloc(1, sizeof(struct termios)); if (!termios_p) return PyErr_NoMemory(); if (tcgetattr(fd, termios_p) != 0) { free(termios_p); PyErr_SetFromErrno(PyExc_OSError); return NULL; }