Skip to content
This repository has been archived by the owner on Aug 11, 2022. It is now read-only.

Commit

Permalink
lifecycle: prefer current node in run-script
Browse files Browse the repository at this point in the history
Fixes: #11175
Fixes: #9253
PR-URL: #11204
Credit: @segrey
Reviewed-By: @iarna
  • Loading branch information
segrey authored and iarna committed Jan 28, 2016
1 parent f427934 commit 3eae40b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 3 additions & 0 deletions lib/utils/lifecycle.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ function lifecycle_ (pkg, stage, wd, env, unsafe, failOk, cb) {
// the bundled one will be used for installing things.
pathArr.unshift(path.join(__dirname, '..', '..', 'bin', 'node-gyp-bin'))

// prefer current node interpreter in child scripts
pathArr.push(path.dirname(process.execPath))

if (env[PATH]) pathArr.push(env[PATH])
env[PATH] = pathArr.join(process.platform === 'win32' ? ';' : ':')

Expand Down
3 changes: 2 additions & 1 deletion test/tap/lifecycle-path.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ test('make sure the path is correct', function (t) {
// get the ones we tacked on, then the system-specific requirements
var expect = [
'{{ROOT}}/bin/node-gyp-bin',
'{{ROOT}}/test/tap/lifecycle-path/node_modules/.bin'
'{{ROOT}}/test/tap/lifecycle-path/node_modules/.bin',
path.dirname(process.execPath)
].concat(PATH.split(pathSplit).map(function (p) {
return p.replace(/\\/g, '/')
}))
Expand Down

0 comments on commit 3eae40b

Please sign in to comment.