console: unregister temporary error listener

PR-URL: https://github.com/nodejs/node/pull/30852
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Rich Trott <rtrott@gmail.com>
This commit is contained in:
Robert Nagy 2019-12-08 10:58:13 +01:00 committed by Rich Trott
parent d06efafe6b
commit d64c1dc24a

View File

@ -213,7 +213,7 @@ function createWriteErrorHandler(instance, streamSymbol) {
// removed after the event, non-console.* writes won't be affected. // removed after the event, non-console.* writes won't be affected.
// we are only adding noop if there is no one else listening for 'error' // we are only adding noop if there is no one else listening for 'error'
if (stream.listenerCount('error') === 0) { if (stream.listenerCount('error') === 0) {
stream.on('error', noop); stream.once('error', noop);
} }
} }
}; };