1'use strict'; 2 3const common = require('../common'); 4const { Writable } = require('stream'); 5const { Console } = require('console'); 6const { EventEmitter } = require('events'); 7 8const stream = new Writable({ 9 write(chunk, enc, cb) { 10 cb(); 11 }, 12 writev(chunks, cb) { 13 setTimeout(cb, 10, new Error('kaboom')); 14 } 15}); 16const myConsole = new Console(stream, stream); 17 18process.on('warning', common.mustNotCall); 19 20stream.cork(); 21for (let i = 0; i < EventEmitter.defaultMaxListeners + 1; i++) { 22 myConsole.log('a message'); 23} 24stream.uncork(); 25