Permalink
Browse files

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: #18210
Fixes: nodejs/citgm#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>
  • Loading branch information...
apapirovski committed Jan 17, 2018
1 parent 359a232 commit 38ee25e2e205270c6ff258742aa34b442d9bc580
Showing with 3 additions and 2 deletions.
  1. +2 −1 lib/child_process.js
  2. +1 −1 test/parallel/test-child-process-env.js
@@ -504,7 +504,8 @@ function normalizeSpawnArguments(file, args, options) {
var env = options.env || process.env;
var envPairs = [];
for (const key of Object.keys(env)) {
// Prototype values are intentionally included.
for (var key in env) {
const value = env[key];
if (value !== undefined) {
envPairs.push(`${key}=${value}`);
@@ -57,7 +57,7 @@ child.stdout.on('data', function(chunk) {
process.on('exit', function() {
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('NULL=null'));
assert.ok(response.includes(`EMPTY=${os.EOL}`));

0 comments on commit 38ee25e

Please sign in to comment.