This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Read up the prototype of the 'env' object.

Closes GH-713.
  • Loading branch information...
TooTallNate authored and ry committed Feb 18, 2011
1 parent 8a50f23 commit a9a252fda9054a90cd0be17ea1ea492c82c317c2
Showing with 11 additions and 3 deletions.
  1. +1 −2 lib/child_process.js
  2. +10 −1 test/simple/test-child-process-env.js
View
@@ -215,8 +215,7 @@ ChildProcess.prototype.spawn = function(path, args, options, customFds) {
var envPairs = [];
var keys = Object.keys(env);
for (var index = 0, keysLength = keys.length; index < keysLength; index++) {
var key = keys[index];
for (var key in env) {
envPairs.push(key + '=' + env[key]);
}
@@ -2,7 +2,15 @@ var common = require('../common');
var assert = require('assert');
var spawn = require('child_process').spawn;
var child = spawn('/usr/bin/env', [], {env: {'HELLO': 'WORLD'}});
var env = {
'HELLO': 'WORLD'
};
env.__proto__ = {
'FOO': 'BAR'
}
var child = spawn('/usr/bin/env', [], {env: env});
var response = '';
@@ -15,4 +23,5 @@ child.stdout.addListener('data', function(chunk) {
process.addListener('exit', function() {
assert.ok(response.indexOf('HELLO=WORLD') >= 0);
assert.ok(response.indexOf('FOO=BAR') >= 0);
});

0 comments on commit a9a252f

Please sign in to comment.