From ec20016f6c2f3ca399cbb6fa17634fb9f0d780f7 Mon Sep 17 00:00:00 2001 From: Ahad Birang Date: Sun, 26 Jun 2022 20:48:13 +0200 Subject: [PATCH] fix: supply `process.env` fallback (#54) * fix: handle undefined `process.env` * chore: update `kleur/colors` too Co-authored-by: Luke Edwards --- colors.mjs | 2 +- index.mjs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/colors.mjs b/colors.mjs index 401843c..e9feb83 100644 --- a/colors.mjs +++ b/colors.mjs @@ -1,6 +1,6 @@ let FORCE_COLOR, NODE_DISABLE_COLORS, NO_COLOR, TERM, isTTY=true; if (typeof process !== 'undefined') { - ({ FORCE_COLOR, NODE_DISABLE_COLORS, NO_COLOR, TERM } = process.env); + ({ FORCE_COLOR, NODE_DISABLE_COLORS, NO_COLOR, TERM } = process.env || {}); isTTY = process.stdout && process.stdout.isTTY; } diff --git a/index.mjs b/index.mjs index 32e7fa1..96dadad 100644 --- a/index.mjs +++ b/index.mjs @@ -2,7 +2,7 @@ let FORCE_COLOR, NODE_DISABLE_COLORS, NO_COLOR, TERM, isTTY=true; if (typeof process !== 'undefined') { - ({ FORCE_COLOR, NODE_DISABLE_COLORS, NO_COLOR, TERM } = process.env); + ({ FORCE_COLOR, NODE_DISABLE_COLORS, NO_COLOR, TERM } = process.env || {}); isTTY = process.stdout && process.stdout.isTTY; }