From 328f569c16638afb7b4fcf5575de922104817787 Mon Sep 17 00:00:00 2001 From: Rafael Kitover Date: Sat, 23 May 2020 12:21:57 +0000 Subject: [PATCH] Fix child spawn on FreeBSD. Fix typo: "#ifdef TIOCSTTY" -> "#ifdef TIOCSCTTY" Include standard header sys/ioctl.h for ioctl(), needed on MacOS. Include standard header termios.h for TIOCSCTTY. Fixes this error on spawn of child shell process: bash: cannot set terminal process group (-1): Inappropriate ioctl for device bash: no job control in this shell Tested on FreeBSD and Linux. - Fix #2529 Signed-off-by: Rafael Kitover --- kitty/child.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/kitty/child.c b/kitty/child.c index c0bede074..54edc6908 100644 --- a/kitty/child.c +++ b/kitty/child.c @@ -12,6 +12,8 @@ #include #include #include +#include +#include static inline char** serialize_string_tuple(PyObject *src) { @@ -93,7 +95,7 @@ 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 +#ifdef TIOCSCTTY // 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