Skip to content

Commit

Permalink
More robust isTTY check (#63)
Browse files Browse the repository at this point in the history
  • Loading branch information
kibertoad committed Sep 7, 2021
1 parent 44296f0 commit 9b6f41e
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
@@ -1,12 +1,13 @@
import * as tty from 'tty';
const env = process.env;

const isDisabled = "NO_COLOR" in env
const isForced = "FORCE_COLOR" in env
const isWindows = process.platform === "win32"

const isCompatibleTerminal =
process.stdout != null &&
process.stdout.isTTY &&
tty &&
tty.isatty(1) &&
env.TERM &&
env.TERM !== "dumb"

Expand Down

0 comments on commit 9b6f41e

Please sign in to comment.