0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00
nodejs/test/parallel/test-child-process-default-options.js
Sakthipriyan Vairamani d5ab92bcc1 test: use common.isWindows consistently
In the tests, we use "process.platform === 'win32'" in some places.
This patch replaces them with the "common.isWindows" for consistency.

PR-URL: https://github.com/nodejs/io.js/pull/2269
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
2015-07-31 00:29:36 +05:30

28 lines
590 B
JavaScript

'use strict';
var common = require('../common');
var assert = require('assert');
var spawn = require('child_process').spawn;
process.env.HELLO = 'WORLD';
if (common.isWindows) {
var child = spawn('cmd.exe', ['/c', 'set'], {});
} else {
var child = spawn('/usr/bin/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,
'spawn did not use process.env as default');
});