Browse Source

test: preserve process.env in forked child_process

When LD_LIBRARY_PATH is overriden for custom builds we need to preserve
it for forked process. There are possibly other environment variables
that could cause test failures so we preserve whole environment of
parent process.
v0.10.5-release
Stanislav Ochotnicky 12 years ago
committed by Ben Noordhuis
parent
commit
47198af55a
  1. 5
      test/simple/test-child-process-fork-exec-path.js

5
test/simple/test-child-process-fork-exec-path.js

@ -44,9 +44,12 @@ else {
fs.writeFileSync(copyPath, fs.readFileSync(nodePath)); fs.writeFileSync(copyPath, fs.readFileSync(nodePath));
fs.chmodSync(copyPath, '0755'); fs.chmodSync(copyPath, '0755');
// slow but simple
var envCopy = JSON.parse(JSON.stringify(process.env));
envCopy.FORK = 'true';
var child = require('child_process').fork(__filename, { var child = require('child_process').fork(__filename, {
execPath: copyPath, execPath: copyPath,
env: { FORK: 'true' } env: envCopy
}); });
child.on('message', common.mustCall(function(recv) { child.on('message', common.mustCall(function(recv) {
assert.deepEqual(msg, recv); assert.deepEqual(msg, recv);

Loading…
Cancel
Save