You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Instead, it just loops infinitely writing into an internal buffer until it eats all of your memory. According to nodejs/node#9744 and nodejs/node#11568 this seems to be the intended behaviour.
Anyway, using process.stdout.write instead of console.logdoes still throw EPIPE:
We do see EPIPEs on console.log on Node v19, when stdout is redirected to a truncating sink like head / grep when running node with npx clinic flame
node:events:491
throw er; // Unhandled 'error' event
^
Error: write EPIPE
at afterWriteDispatched (node:internal/stream_base_commons:160:15)
at writeGeneric (node:internal/stream_base_commons:151:3)
at Socket._writeGeneric (node:net:901:11)
at Socket._write (node:net:913:8)
at writeOrBuffer (node:internal/streams/writable:392:12)
at _write (node:internal/streams/writable:333:10)
at Writable.write (node:internal/streams/writable:337:10)
at console.value (node:internal/console/constructor:300:16)
at console.log (node:internal/console/constructor:377:26)
at status (/home/murtaza/bravehub/serverless-dns/node_modules/clinic/bin.js:376:15)
Emitted 'error' event on Socket instance at:
at Socket.onerror (node:internal/streams/readable:785:14)
at Socket.emit (node:events:513:28)
at emitErrorNT (node:internal/streams/destroy:151:8)
at emitErrorCloseNT (node:internal/streams/destroy:116:3)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
errno: -32,
code: 'EPIPE',
syscall: 'write'
}
Node.js v19.0.1
I got here from nodejs/node-v0.x-archive#3211. Thanks for making this.
By default, the following example code from the readme does not throw
EPIPE
when piped intohead
, unlike advertised:Instead, it just loops infinitely writing into an internal buffer until it eats all of your memory. According to nodejs/node#9744 and nodejs/node#11568 this seems to be the intended behaviour.
Anyway, using
process.stdout.write
instead ofconsole.log
does still throwEPIPE
:This module still fixes both classes of problem:
console.log
program to exit instead of deathlooping, andprocess.stdout.write
program to exit happy instead of exit sad.The readme example and prose could use an update to reflect this.
The text was updated successfully, but these errors were encountered: