blob: cac82b9952a4da6d59aa1edac4dfb4ad51de425a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
'use strict';
const common = require('../common');
const assert = require('assert');
const spawn = require('child_process').spawn;
var env = {
'HELLO': 'WORLD'
};
Object.setPrototypeOf(env, {
'FOO': 'BAR'
});
var child;
if (common.isWindows) {
child = spawn('cmd.exe', ['/c', 'set'], {env: env});
} else {
child = spawn('/usr/bin/env', [], {env: env});
}
var response = '';
child.stdout.setEncoding('utf8');
child.stdout.on('data', function(chunk) {
console.log('stdout: ' + chunk);
response += chunk;
});
process.on('exit', function() {
assert.ok(response.indexOf('HELLO=WORLD') >= 0);
assert.ok(response.indexOf('FOO=BAR') >= 0);
});
|