2010-12-06 03:15:30 +08:00
|
|
|
var common = require('../common');
|
2010-12-05 07:20:34 +08:00
|
|
|
var assert = require('assert');
|
2010-03-18 05:00:17 +08:00
|
|
|
|
|
|
|
var spawn = require('child_process').spawn;
|
2011-02-19 05:44:20 +08:00
|
|
|
|
|
|
|
var env = {
|
|
|
|
'HELLO': 'WORLD'
|
|
|
|
};
|
|
|
|
env.__proto__ = {
|
|
|
|
'FOO': 'BAR'
|
|
|
|
}
|
|
|
|
|
|
|
|
var child = spawn('/usr/bin/env', [], {env: env});
|
2010-03-18 05:00:17 +08:00
|
|
|
|
2010-12-06 03:15:30 +08:00
|
|
|
var response = '';
|
2010-03-04 02:45:58 +08:00
|
|
|
|
2010-03-18 05:00:17 +08:00
|
|
|
child.stdout.setEncoding('utf8');
|
|
|
|
|
2010-12-06 03:15:30 +08:00
|
|
|
child.stdout.addListener('data', function(chunk) {
|
|
|
|
console.log('stdout: ' + chunk);
|
2010-03-18 05:00:17 +08:00
|
|
|
response += chunk;
|
2010-03-04 02:45:58 +08:00
|
|
|
});
|
|
|
|
|
2010-12-06 03:15:30 +08:00
|
|
|
process.addListener('exit', function() {
|
|
|
|
assert.ok(response.indexOf('HELLO=WORLD') >= 0);
|
2011-02-19 05:44:20 +08:00
|
|
|
assert.ok(response.indexOf('FOO=BAR') >= 0);
|
2010-03-04 02:45:58 +08:00
|
|
|
});
|