mirror of
https://github.com/nodejs/node.git
synced 2026-11-26 21:58:26 -05:00
Backport-PR-URL: https://github.com/nodejs/node/pull/13835 PR-URL: https://github.com/nodejs/node/pull/12735 Refs: https://github.com/nodejs/node/pull/12455 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
29 lines
595 B
JavaScript
29 lines
595 B
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
|
|
const spawn = require('child_process').spawn;
|
|
|
|
process.env.HELLO = 'WORLD';
|
|
|
|
let child;
|
|
if (common.isWindows) {
|
|
child = spawn('cmd.exe', ['/c', 'set'], {});
|
|
} else {
|
|
child = spawn('/usr/bin/env', [], {});
|
|
}
|
|
|
|
let response = '';
|
|
|
|
child.stdout.setEncoding('utf8');
|
|
|
|
child.stdout.on('data', function(chunk) {
|
|
console.log(`stdout: ${chunk}`);
|
|
response += chunk;
|
|
});
|
|
|
|
process.on('exit', function() {
|
|
assert.ok(response.includes('HELLO=WORLD'),
|
|
'spawn did not use process.env as default');
|
|
});
|