Browse Source

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>
v7.x
Myles Borins 9 years ago
committed by Myles Borins
parent
commit
56ae651c80
  1. 7
      test/parallel/test-npm-install.js

7
test/parallel/test-npm-install.js

@ -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) {

Loading…
Cancel
Save