Open vsukhomlinov opened 9 years ago
can you post the "correct" output that you are expecting?
I'd expect all queue() calls for the handler be executed sequentially within the function, like this
$ printf "a\nb\n" | node pipeTest.js
*|a
*|b
*|
*|
oh okay I see what the problem is now. you are using the readable event the wrong way. that is part of the private streams2 api. probably, this is causing you to pipe the same stream twice.
instead just do process.stdin.pipe(es.split()).pipe(streamLine).pipe(process.stdout)
Multiple queue() calls within the es.through() handler get sent downstream in wrong order:
I'm testing it like this
An interesting note is that calling streamLine1 from closure renders everything properly.