2015-05-19 13:00:06 +02:00
|
|
|
'use strict';
|
2014-07-07 16:38:05 -07:00
|
|
|
var common = require('../common');
|
|
|
|
var assert = require('assert');
|
|
|
|
|
|
|
|
var spawn = require('child_process').spawn;
|
|
|
|
|
|
|
|
process.env.HELLO = 'WORLD';
|
|
|
|
|
2016-01-28 23:02:57 -08:00
|
|
|
var child;
|
2015-07-29 17:18:04 +05:30
|
|
|
if (common.isWindows) {
|
2016-01-28 23:02:57 -08:00
|
|
|
child = spawn('cmd.exe', ['/c', 'set'], {});
|
2014-07-07 16:38:05 -07:00
|
|
|
} else {
|
2016-01-28 23:02:57 -08:00
|
|
|
child = spawn('/usr/bin/env', [], {});
|
2014-07-07 16:38:05 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
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,
|
|
|
|
'spawn did not use process.env as default');
|
|
|
|
});
|