Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
test: robust handling of env for npm-test-install
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 authored and MylesBorins committed May 18, 2016
commit 56ae651c802504127a6361d56319afa8e6911d8f
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