From 55239519c57b82521605622e6c71640a31ed4586 Mon Sep 17 00:00:00 2001 From: Matt Ezell Date: Thu, 18 Apr 2019 14:29:39 -0500 Subject: [PATCH] feat(process.env.path): Use platform specific path casing if present Assume proper win32 path casing - only seek out alternative casing if win32 OS specific casing not present. Fix: #29 PR-URL: https://github.com/npm/npm-lifecycle/pull/30 Close: #30 Reviewed-by: @isaacs --- index.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/index.js b/index.js index 4287648..a6cf4f5 100644 --- a/index.js +++ b/index.js @@ -23,11 +23,13 @@ let PATH = 'PATH' // windows calls it's path 'Path' usually, but this is not guaranteed. if (process.platform === 'win32') { PATH = 'Path' - Object.keys(process.env).forEach(function (e) { - if (e.match(/^PATH$/i)) { - PATH = e - } - }) + if (!process.env[PATH]) { + Object.keys(process.env).forEach(function (e) { + if (e.match(/^PATH$/i)) { + PATH = e + } + }) + } } function logid (pkg, stage) {