Skip to content

Commit 1ee6df9

Browse files
rvaggevanlucas
authored andcommitted
test: pass process.env to child processes
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 <[email protected]> Reviewed-By: Gibson Fahnestock <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Gireesh Punathil <[email protected]>
1 parent 6e9973e commit 1ee6df9

4 files changed

+7
-9
lines changed

benchmark/_http-benchmarkers.js

+3-5
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,9 @@ class TestDoubleBenchmarker {
9191
create(options) {
9292
const child = child_process.fork(this.executable, {
9393
silent: true,
94-
env: {
95-
duration: options.duration,
96-
connections: options.connections,
97-
path: `http://127.0.0.1:${options.port}${options.path}`
98-
}
94+
env: Object.assign({}, process.env, {
95+
test_url: `http://127.0.0.1:${options.port}${options.path}`
96+
})
9997
});
10098
return child;
10199
}

benchmark/_test-double-benchmarker.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
const http = require('http');
44

5-
http.get(process.env.path, function() {
5+
http.get(process.env.test_url, function() {
66
console.log(JSON.stringify({ throughput: 1 }));
77
});

test/parallel/test-child-process-fork-no-shell.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const expected = common.isWindows ? '%foo%' : '$foo';
88
if (process.argv[2] === undefined) {
99
const child = cp.fork(__filename, [expected], {
1010
shell: true,
11-
env: { foo: 'bar' }
11+
env: Object.assign({}, process.env, { foo: 'bar' })
1212
});
1313

1414
child.on('exit', common.mustCall((code, signal) => {

test/sequential/test-inspector-port-cluster.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -311,11 +311,11 @@ function workerProcessMain() {
311311
function spawnMaster({ execArgv, workers, clusterSettings = {} }) {
312312
return new Promise((resolve) => {
313313
childProcess.fork(__filename, {
314-
env: {
314+
env: Object.assign({}, process.env, {
315315
workers: JSON.stringify(workers),
316316
clusterSettings: JSON.stringify(clusterSettings),
317317
testProcess: true
318-
},
318+
}),
319319
execArgv
320320
}).on('exit', common.mustCall((code, signal) => {
321321
checkExitCode(code, signal);

0 commit comments

Comments
 (0)