Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRebecca Turner <me@re-becca.org>2015-10-12 20:44:22 +0300
committerRebecca Turner <me@re-becca.org>2015-10-12 20:44:22 +0300
commitddde1d5480f52c3991d3b56645ac4c5cedd55c2f (patch)
treed4a5b9cae2a2b8735e74f30324bef7d6e4515d59 /lib
parent835ae5a2c55164c111ac142ce50ff2dfad88799c (diff)
Revert "lifecycle: Swap out custom logic with add-to-path module"
This reverts commit 22a3af055f934f8de20ebd5f4a286447dda84f81.
Diffstat (limited to 'lib')
-rw-r--r--lib/utils/lifecycle.js19
1 files changed, 15 insertions, 4 deletions
diff --git a/lib/utils/lifecycle.js b/lib/utils/lifecycle.js
index ed0ed7be2..766145f18 100644
--- a/lib/utils/lifecycle.js
+++ b/lib/utils/lifecycle.js
@@ -9,11 +9,20 @@ var path = require('path')
var fs = require('graceful-fs')
var chain = require('slide').chain
var Stream = require('stream').Stream
-var addToPath = require('add-to-path')
-var getPathVar = require('add-to-path/dist/get-path-var')
+var PATH = 'PATH'
var uidNumber = require('uid-number')
var umask = require('./umask')
+// 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
+ }
+ })
+}
+
function logid (pkg, stage) {
return pkg._id + '~' + stage + ':'
}
@@ -80,7 +89,9 @@ function lifecycle_ (pkg, stage, wd, env, unsafe, failOk, cb) {
// we also unshift the bundled node-gyp-bin folder so that
// the bundled one will be used for installing things.
pathArr.unshift(path.join(__dirname, '..', '..', 'bin', 'node-gyp-bin'))
- addToPath(pathArr)
+
+ if (env[PATH]) pathArr.push(env[PATH])
+ env[PATH] = pathArr.join(process.platform === 'win32' ? ';' : ':')
var packageLifecycle = pkg.scripts && pkg.scripts.hasOwnProperty(stage)
@@ -205,7 +216,7 @@ function runCmd_ (cmd, pkg, env, wd, stage, unsafe, uid, gid, cb_) {
conf.windowsVerbatimArguments = true
}
- log.verbose('lifecycle', logid(pkg, stage), 'PATH:', env[getPathVar()])
+ log.verbose('lifecycle', logid(pkg, stage), 'PATH:', env[PATH])
log.verbose('lifecycle', logid(pkg, stage), 'CWD:', wd)
log.silly('lifecycle', logid(pkg, stage), 'Args:', [shFlag, cmd])