Commit d82bedcb authored by Matteo Collina's avatar Matteo Collina
Browse files

console: avoid adding infinite error listeners

If the console destination is a unix pipe (net.Socket), write() is
async. If the destination is broken, we are adding an 'error' event
listener to avoid a process crash. This PR makes sure that we are adding
that listener only once.

Fixes: https://github.com/nodejs/node/issues/16767

PR-URL: https://github.com/nodejs/node/pull/16770
Fixes: https://github.com/nodejs/node/issues/16767


Reviewed-By: default avatarJames M Snell <jasnell@gmail.com>
Reviewed-By: default avatarAnna Henningsen <anna@addaleax.net>
Reviewed-By: default avatarColin Ihrig <cjihrig@gmail.com>
Reviewed-By: default avatarAnatoli Papirovski <apapirovski@mac.com>
Reviewed-By: default avatarLuigi Pinca <luigipinca@gmail.com>
Reviewed-By: default avatarSam Roberts <vieuxtech@gmail.com>
parent 5dca7879
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment