Closed isao closed 11 years ago
maybe related to stream changes? https://github.com/joyent/node/blob/master/ChangeLog
or maybe I'm doing something dumb...
if this has been introduced in 0.11, then possibly this is an issue with node 0.11, can you post an issue on node and link it here?
I can open an issue on node, since AFAICT it worked up until 0.11.0, and only fails in 0.11.2. But since things work if I remove the through-stream part, I'm not sure they'll think it's a node issue.
I'll try to do a simplified repro case, and maybe I'll get some more insight either way...
Thanks for the response (and all the libraries).
streams2 is ment to be backwards compatible, so if this breaks old streams, then that is not backwards compatible.
hmm, maybe it's to do with the finish event?
wild guess, maybe something to do with the stream finish ordering? joyent/node@c38ce9bc0a143141abfa638289b458ddaaac26d6
hmm, maybe. did you post an issue on node?
Hi Dominic, sorry for delay. Filed issue with joyent/node.
Ah, my repro case works fine in 0.11.3, 0.11.2. Problem is with my unit test code, I think.
Sorry I hadn't taken more time running this down-- through
is pretty great. Thanks.
Hi Dominic,
So actually the issue isn't with my test code (I still had the issue discussed above with never getting a "close" event, I just made a bad repro case).
But coincidentally I fixed a bug (isao/mojito-cli-create@2dea106b59f5da48ff118ff623cdd6837d4b3f2e) and all tests passed on node 0.11.2, 0.11.3. (The bug was my replacer code would "eat" a trailing newline, and just enqueue an empty string.)
My theory is this line in through
requires buffer.length
to be truthy to "end", but an empty string yielded a falsey buffer.length on node 0.11.2?
Node's buffer.js changes on June 18 do seems to include related changes.
To reproduce:
npm i through
node index.js
with node ~0.11.2 -- "done!" is not logged to the console. node index.js
with earlier versions of node, "done!" is logged to the console. Not sure if this is a documentation thing for through
, or a small edge case, or what. Hope this is helpful at least.
I use
through
to do key/value replacement on a file stream. On node 0.11.2 the "close" event is never emitted. But things are fine on node versions 0.11.0, 0.8.x & 0.10.x.The through-stream code is replacers.js. It is used here.
If I change those lines from
to
...the "close" event is emitted as expected.