From f7ab3ffcb781c14bf35da8260518456d00cea04d Mon Sep 17 00:00:00 2001 From: Tristan Partin Date: Tue, 13 Aug 2024 14:05:06 -0500 Subject: [PATCH] Check that TERM != dumb before using colors in pre-commit.py Signed-off-by: Tristan Partin --- pre-commit.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pre-commit.py b/pre-commit.py index c5ed63ac443d..ae432e82251f 100755 --- a/pre-commit.py +++ b/pre-commit.py @@ -2,6 +2,7 @@ import argparse import enum +import os import subprocess import sys from typing import List @@ -93,7 +94,7 @@ def check(name: str, suffix: str, cmd: str, changed_files: List[str], no_color: "--no-color", action="store_true", help="disable colored output", - default=not sys.stdout.isatty(), + default=not sys.stdout.isatty() or os.getenv("TERM") == "dumb", ) args = parser.parse_args()