11cb0ef41Sopenharmony_ci'use strict'; 21cb0ef41Sopenharmony_ci// See https://github.com/nodejs/node/issues/5927 31cb0ef41Sopenharmony_ci 41cb0ef41Sopenharmony_ciconst common = require('../common'); 51cb0ef41Sopenharmony_ciconst assert = require('assert'); 61cb0ef41Sopenharmony_ciconst spawn = require('child_process').spawn; 71cb0ef41Sopenharmony_ci 81cb0ef41Sopenharmony_ciif (process.argv[2] === 'child') { 91cb0ef41Sopenharmony_ci process.stdin.pipe(process.stdout); 101cb0ef41Sopenharmony_ci return; 111cb0ef41Sopenharmony_ci} 121cb0ef41Sopenharmony_ci 131cb0ef41Sopenharmony_ciconst child = spawn(process.execPath, [__filename, 'child'], { stdio: 'pipe' }); 141cb0ef41Sopenharmony_ci 151cb0ef41Sopenharmony_ciconst expectedBytes = 1024 * 1024; 161cb0ef41Sopenharmony_cilet readBytes = 0; 171cb0ef41Sopenharmony_ci 181cb0ef41Sopenharmony_cichild.stdin.end(Buffer.alloc(expectedBytes)); 191cb0ef41Sopenharmony_ci 201cb0ef41Sopenharmony_cichild.stdout.on('data', (chunk) => readBytes += chunk.length); 211cb0ef41Sopenharmony_cichild.stdout.on('end', common.mustCall(() => { 221cb0ef41Sopenharmony_ci assert.strictEqual(readBytes, expectedBytes); 231cb0ef41Sopenharmony_ci})); 24