mirror of
https://github.com/nodejs/node.git
synced 2024-11-28 22:46:31 +01:00
3e1b1dd4a9
The copyright and license notice is already in the LICENSE file. There is no justifiable reason to also require that it be included in every file, since the individual files are not individually distributed except as part of the entire package.
35 lines
802 B
JavaScript
35 lines
802 B
JavaScript
var common = require('../common');
|
|
var assert = require('assert');
|
|
var spawn = require('child_process').spawn;
|
|
|
|
if (process.argv[2] === 'parent')
|
|
parent();
|
|
else
|
|
grandparent();
|
|
|
|
function grandparent() {
|
|
var child = spawn(process.execPath, [__filename, 'parent']);
|
|
child.stderr.pipe(process.stderr);
|
|
var output = '';
|
|
var input = 'asdfasdf';
|
|
|
|
child.stdout.on('data', function(chunk) {
|
|
output += chunk;
|
|
});
|
|
child.stdout.setEncoding('utf8');
|
|
|
|
child.stdin.end(input);
|
|
|
|
child.on('close', function(code, signal) {
|
|
assert.equal(code, 0);
|
|
assert.equal(signal, null);
|
|
// cat on windows adds a \r\n at the end.
|
|
assert.equal(output.trim(), input.trim());
|
|
});
|
|
}
|
|
|
|
function parent() {
|
|
// should not immediately exit.
|
|
var child = common.spawnCat({ stdio: 'inherit' });
|
|
}
|