-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Description
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 into head
, unlike advertised:
;(function log() {
console.log('tick')
process.nextTick(log)
})()
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.log
does still throw EPIPE
:
;(function log() {
process.stdout.write('tick\n')
process.nextTick(log)
})()
$ node -v
v14.1.0
This module still fixes both classes of problem:
- causes the
console.log
program to exit instead of deathlooping, and - causes the
process.stdout.write
program to exit happy instead of exit sad.
The readme example and prose could use an update to reflect this.
DTrejo, ignoramous and bytemain
Metadata
Metadata
Assignees
Labels
No labels