From 892637683ca20dcb133db6375641d020c722ec79 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 29 Jul 2018 13:48:14 +0530 Subject: [PATCH] Fix controlling terminal not being set on BSD Fixes #764 --- kitty/child.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/kitty/child.c b/kitty/child.c index d5c6876fb..bb2f63a07 100644 --- a/kitty/child.c +++ b/kitty/child.c @@ -79,6 +79,10 @@ spawn(PyObject *self UNUSED, PyObject *args) { // Establish the controlling terminal (see man 7 credentials) int tfd = open(name, O_RDWR); if (tfd == -1) exit_on_err("Failed to open controlling terminal"); +#ifdef TIOCSTTY + // On BSD open() does not establish the controlling terminal + if (ioctl(tfd, TIOCSCTTY, 0) == -1) exit_on_err("Failed to set controlling terminal with TIOCSCTTY"); +#endif close(tfd); environ = env;