child_process: do not ignore proto values of env
This reverts this behaviour introduced in a recent PR, and updates the test. Without this change, CitGM and other packages are broken. PR-URL: https://github.com/nodejs/node/pull/18210 Fixes: https://github.com/nodejs/citgm/issues/536 Reviewed-By: Evan Lucas <evanlucas@me.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com>
This commit is contained in:
parent
359a232348
commit
38ee25e2e2
@ -504,7 +504,8 @@ function normalizeSpawnArguments(file, args, options) {
|
|||||||
var env = options.env || process.env;
|
var env = options.env || process.env;
|
||||||
var envPairs = [];
|
var envPairs = [];
|
||||||
|
|
||||||
for (const key of Object.keys(env)) {
|
// Prototype values are intentionally included.
|
||||||
|
for (var key in env) {
|
||||||
const value = env[key];
|
const value = env[key];
|
||||||
if (value !== undefined) {
|
if (value !== undefined) {
|
||||||
envPairs.push(`${key}=${value}`);
|
envPairs.push(`${key}=${value}`);
|
||||||
|
@ -57,7 +57,7 @@ child.stdout.on('data', function(chunk) {
|
|||||||
|
|
||||||
process.on('exit', function() {
|
process.on('exit', function() {
|
||||||
assert.ok(response.includes('HELLO=WORLD'));
|
assert.ok(response.includes('HELLO=WORLD'));
|
||||||
assert.ok(!response.includes('FOO='));
|
assert.ok(response.includes('FOO=BAR'));
|
||||||
assert.ok(!response.includes('UNDEFINED=undefined'));
|
assert.ok(!response.includes('UNDEFINED=undefined'));
|
||||||
assert.ok(response.includes('NULL=null'));
|
assert.ok(response.includes('NULL=null'));
|
||||||
assert.ok(response.includes(`EMPTY=${os.EOL}`));
|
assert.ok(response.includes(`EMPTY=${os.EOL}`));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user