Skip to content

Commit

Permalink
test: pass process.env to child processes
Browse files Browse the repository at this point in the history
For variables such as LD_LIBRARY_PATH and DYLD_LIBRARY_PATH that are
needed for dynamically linked binaries

PR-URL: #16405
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
  • Loading branch information
rvagg committed Nov 9, 2017
1 parent 5e1e460 commit 3b3ceaf
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 9 deletions.
8 changes: 3 additions & 5 deletions benchmark/_http-benchmarkers.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,9 @@ class TestDoubleBenchmarker {
create(options) {
const child = child_process.fork(this.executable, {
silent: true,
env: {
duration: options.duration,
connections: options.connections,
path: `http://127.0.0.1:${options.port}${options.path}`
}
env: Object.assign({}, process.env, {
test_url: `http://127.0.0.1:${options.port}${options.path}`
})
});
return child;
}
Expand Down
2 changes: 1 addition & 1 deletion benchmark/_test-double-benchmarker.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

const http = require('http');

http.get(process.env.path, function() {
http.get(process.env.test_url, function() {
console.log(JSON.stringify({ throughput: 1 }));
});
2 changes: 1 addition & 1 deletion test/parallel/test-child-process-fork-no-shell.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const expected = common.isWindows ? '%foo%' : '$foo';
if (process.argv[2] === undefined) {
const child = cp.fork(__filename, [expected], {
shell: true,
env: { foo: 'bar' }
env: Object.assign({}, process.env, { foo: 'bar' })
});

child.on('exit', common.mustCall((code, signal) => {
Expand Down
4 changes: 2 additions & 2 deletions test/sequential/test-inspector-port-cluster.js
Original file line number Diff line number Diff line change
Expand Up @@ -311,11 +311,11 @@ function workerProcessMain() {
function spawnMaster({ execArgv, workers, clusterSettings = {} }) {
return new Promise((resolve) => {
childProcess.fork(__filename, {
env: {
env: Object.assign({}, process.env, {
workers: JSON.stringify(workers),
clusterSettings: JSON.stringify(clusterSettings),
testProcess: true
},
}),
execArgv
}).on('exit', common.mustCall((code, signal) => {
checkExitCode(code, signal);
Expand Down

0 comments on commit 3b3ceaf

Please sign in to comment.