Skip to content

Commit

Permalink
fix process .isTTY detection (#3240)
Browse files Browse the repository at this point in the history
  • Loading branch information
tim-smart authored Jul 12, 2024
1 parent edb0da3 commit dabd028
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/six-kangaroos-jog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"effect": patch
---

fix process .isTTY detection
11 changes: 9 additions & 2 deletions packages/effect/src/internal/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -416,9 +416,16 @@ const defaultDateFormat = (date: Date): string =>
date.getSeconds().toString().padStart(2, "0")
}.${date.getMilliseconds().toString().padStart(3, "0")}`

const processStdoutIsTTY = typeof process === "object" && "stdout" in process && process.stdout.isTTY === true
const processStdoutIsTTY = typeof process === "object" &&
process !== null &&
typeof process.stdout === "object" &&
process.stdout !== null &&
process.stdout.isTTY === true
const hasWindow = typeof window === "object"
const isWorker = typeof self === "object" && self.constructor && self.constructor.name.includes("Worker")
const isWorker = typeof self === "object" &&
self !== null &&
typeof self.constructor === "function" &&
self.constructor.name.includes("Worker")

/** @internal */
export const prettyLogger = (options?: {
Expand Down

0 comments on commit dabd028

Please sign in to comment.