From fbd5837cf2427469b554eeb1bdda15fd0829b5dd Mon Sep 17 00:00:00 2001 From: David Wilson Date: Sun, 24 Jun 2018 17:31:50 +0100 Subject: [PATCH] issue #275: parent: use TIOCSCTTY on Linux too. This appears to be harmless, except for Python 2.6 on Linux/Travis, where for some reason (some stdlib change?) simply opening the TTY is insufficient. --- mitogen/parent.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mitogen/parent.py b/mitogen/parent.py index 88a6ab46..4e2b1c60 100644 --- a/mitogen/parent.py +++ b/mitogen/parent.py @@ -189,8 +189,9 @@ def _acquire_controlling_tty(): # On Linux, the controlling tty becomes the first tty opened by a # process lacking any prior tty. os.close(os.open(os.ttyname(2), os.O_RDWR)) - if sys.platform.startswith('freebsd') or sys.platform == 'darwin': - # On BSD an explicit ioctl is required. + if hasattr(termios, 'TIOCSCTTY'): + # On BSD an explicit ioctl is required. For some inexplicable reason, + # Python 2.6 on Travis also requires it. fcntl.ioctl(2, termios.TIOCSCTTY)