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: #11626
Credit: @segrey
Credit: @narqo
  • Loading branch information
segrey authored and zkat committed Feb 24, 2016
1 parent a985dd5 commit 02813c5
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
Expand Up @@ -83,6 +83,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
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 02813c5

Please sign in to comment.