Skip to content

Commit

Permalink
Fix detection of dumb terminals on Windows (#91)
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinKolarik authored Jun 3, 2022
1 parent 840f50e commit 1674926
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,17 @@ const argv = process.argv || []
const isDisabled = "NO_COLOR" in env || argv.includes("--no-color")
const isForced = "FORCE_COLOR" in env || argv.includes("--color")
const isWindows = process.platform === "win32"
const isDumbTerminal = env.TERM === "dumb"

const isCompatibleTerminal =
tty && tty.isatty && tty.isatty(1) && env.TERM && env.TERM !== "dumb"
tty && tty.isatty && tty.isatty(1) && env.TERM && !isDumbTerminal

const isCI =
"CI" in env &&
("GITHUB_ACTIONS" in env || "GITLAB_CI" in env || "CIRCLECI" in env)

export const isColorSupported =
!isDisabled && (isForced || isWindows || isCompatibleTerminal || isCI)
!isDisabled && (isForced || (isWindows && !isDumbTerminal) || isCompatibleTerminal || isCI)

const replaceClose = (
index,
Expand Down

0 comments on commit 1674926

Please sign in to comment.