Skip to content

Commit

Permalink
test: robust handling of env for npm-test-install
Browse files Browse the repository at this point in the history
Currently we are overwriting the entire env object of the child-process
spawned in `npm-test-install`. This commit alternatively clones the
`process.env` object and modifies it with the neccessary changes before
passing it the the spawned process.

Fixes: #6736

PR-URL: #6797
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
Myles Borins committed Jun 2, 2016
1 parent 072c32f commit 08777c0
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions test/parallel/test-npm-install.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,12 @@ const pkgPath = path.join(common.tmpDir, 'package.json');

fs.writeFileSync(pkgPath, pkgContent);

const env = Object.create(process.env);
env['PATH'] = path.dirname(process.execPath);

const proc = spawn(process.execPath, args, {
cwd: common.tmpDir,
env: {
PATH: path.dirname(process.execPath)
}
env: env
});

function handleExit(code, signalCode) {
Expand Down

0 comments on commit 08777c0

Please sign in to comment.