Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: pass process.env to child processes #16405

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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