summaryrefslogtreecommitdiff
path: root/deps/npm/node_modules/npm-lifecycle/index.js
diff options
context:
space:
mode:
Diffstat (limited to 'deps/npm/node_modules/npm-lifecycle/index.js')
-rw-r--r--deps/npm/node_modules/npm-lifecycle/index.js17
1 files changed, 15 insertions, 2 deletions
diff --git a/deps/npm/node_modules/npm-lifecycle/index.js b/deps/npm/node_modules/npm-lifecycle/index.js
index be5eadb3e8..040269be40 100644
--- a/deps/npm/node_modules/npm-lifecycle/index.js
+++ b/deps/npm/node_modules/npm-lifecycle/index.js
@@ -12,6 +12,10 @@ const chain = require('slide').chain
const uidNumber = require('uid-number')
const umask = require('umask')
const which = require('which')
+const byline = require('byline')
+const resolveFrom = require('resolve-from')
+
+const DEFAULT_NODE_GYP_PATH = resolveFrom(__dirname, 'node-gyp/bin/node-gyp')
let PATH = 'PATH'
@@ -61,6 +65,7 @@ function lifecycle (pkg, stage, wd, opts) {
env.npm_node_execpath = env.NODE = env.NODE || process.execPath
env.npm_execpath = require.main.filename
env.INIT_CWD = process.cwd()
+ env.npm_config_node_gyp = env.npm_config_node_gyp || DEFAULT_NODE_GYP_PATH
// 'nobody' typically doesn't have permission to write to /tmp
// even if it's never used, sh freaks out.
@@ -91,7 +96,7 @@ function lifecycle_ (pkg, stage, wd, opts, env, 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'))
+ pathArr.unshift(path.join(__dirname, 'node-gyp-bin'))
if (shouldPrependCurrentNodeDirToPATH(opts)) {
// prefer current node interpreter in child scripts
@@ -244,7 +249,7 @@ function runCmd_ (cmd, pkg, env, wd, opts, stage, unsafe, uid, gid, cb_) {
var conf = {
cwd: wd,
env: env,
- stdio: [ 0, 1, 2 ]
+ stdio: opts.stdio || [ 0, 1, 2 ]
}
if (!unsafe) {
@@ -282,6 +287,12 @@ function runCmd_ (cmd, pkg, env, wd, opts, stage, unsafe, uid, gid, cb_) {
}
procError(er)
})
+ byline(proc.stdout).on('data', function (data) {
+ opts.log.verbose('lifecycle', logid(pkg, stage), 'stdout', data.toString())
+ })
+ byline(proc.stderr).on('data', function (data) {
+ opts.log.verbose('lifecycle', logid(pkg, stage), 'stderr', data.toString())
+ })
process.once('SIGTERM', procKill)
process.once('SIGINT', procInterupt)
@@ -355,6 +366,8 @@ function makeEnv (data, opts, prefix, env) {
)
}
+ if (opts.nodeOptions) env.NODE_OPTIONS = opts.nodeOptions
+
for (i in data) {
if (i.charAt(0) !== '_') {
var envKey = (prefix + i).replace(/[^a-zA-Z0-9_]/g, '_')