Skip to content

Commit

Permalink
Make sure isatty exists, fix #64
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgebucaran committed Sep 21, 2021
1 parent cf35254 commit 38bbdc4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const isForced = "FORCE_COLOR" in env
const isWindows = platform === "win32"

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

const isCI =
"CI" in env &&
Expand Down

1 comment on commit 38bbdc4

@LeoniePhiline
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jorgebucaran I’m not entirely sure, but I believe “tty” might be undefined in some contexts?

commonJs bundles are mentioned here: #64 (comment)

I believe you’d need to use “tty?.isatty?.(1)” (must be transpiled for zombie browsers) or “tty && tty.isatty && tty.isatty(1)”

Please sign in to comment.