1'use strict'; 2// See https://github.com/nodejs/node/issues/5927 3 4const common = require('../common'); 5const assert = require('assert'); 6const spawn = require('child_process').spawn; 7 8if (process.argv[2] === 'child') { 9 process.stdin.pipe(process.stdout); 10 return; 11} 12 13const child = spawn(process.execPath, [__filename, 'child'], { stdio: 'pipe' }); 14 15const expectedBytes = 1024 * 1024; 16let readBytes = 0; 17 18child.stdin.end(Buffer.alloc(expectedBytes)); 19 20child.stdout.on('data', (chunk) => readBytes += chunk.length); 21child.stdout.on('end', common.mustCall(() => { 22 assert.strictEqual(readBytes, expectedBytes); 23})); 24