From 26917ba9b59619353525f2deabb52f74effba828 Mon Sep 17 00:00:00 2001 From: Azat Sattarov Date: Wed, 4 Jan 2023 21:41:35 +0000 Subject: [PATCH] Check TTY support for windows terminals --- index.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 0d64e6b..936127f 100644 --- a/index.js +++ b/index.js @@ -11,8 +11,10 @@ const isForced = "FORCE_COLOR" in env || argv.includes("--color") const isWindows = platform === "win32" const isDumbTerminal = env.TERM === "dumb" +const isTty = tty && tty.isatty && tty.isatty(1) + const isCompatibleTerminal = - tty && tty.isatty && tty.isatty(1) && env.TERM && !isDumbTerminal + isTty && env.TERM && !isDumbTerminal const isCI = "CI" in env && @@ -20,7 +22,7 @@ const isCI = export const isColorSupported = !isDisabled && - (isForced || (isWindows && !isDumbTerminal) || isCompatibleTerminal || isCI) + (isForced || (isWindows && !isDumbTerminal && isTty) || isCompatibleTerminal || isCI) const replaceClose = ( index,