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: https://github.com/nodejs/node/issues/6736

PR-URL: https://github.com/nodejs/node/pull/6797
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
Myles Borins committed 2016-06-23 17:25:15 -07:00
1 parent 6a76485ad7
commit 3b94e31245
1 file changed
+4 -3
+4 -3
View File
@@ -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) {