From a84136d070d7f010ad187f808bac2d57bf822506 Mon Sep 17 00:00:00 2001 From: "Gaige B. Paulsen" Date: Sat, 14 May 2022 09:15:03 +0000 Subject: [PATCH] Switch pty use to fix solaris Use the child instead of parent fd when manipulating pty for color. --- pre_commit/util.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pre_commit/util.py b/pre_commit/util.py index 40c53e515..8c296f4d8 100644 --- a/pre_commit/util.py +++ b/pre_commit/util.py @@ -168,10 +168,10 @@ def __enter__(self) -> Pty: self.r, self.w = openpty() # tty flags normally change \n to \r\n - attrs = termios.tcgetattr(self.r) + attrs = termios.tcgetattr(self.w) assert isinstance(attrs[1], int) attrs[1] &= ~(termios.ONLCR | termios.OPOST) - termios.tcsetattr(self.r, termios.TCSANOW, attrs) + termios.tcsetattr(self.w, termios.TCSANOW, attrs) return self