caolan / highland

High-level streams library for Node.js and the browser

Home Page:https://caolan.github.io/highland

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

concat stream not emitting "end" event

benjamine opened this issue · comments

I might be missing something but I'm trying a simple stream concat of 2 streams,
and noticed that while each stream emits the "end" event, the concat result doesn't.

Reproduction Steps:

var highland = require("highland");
(function() {
s1 = highland(['1', '2', '3']), s2 = highland(['4', '5', '6']), s3 = s1.concat(s2);
const log = s => process.stdout.write(` [${s}] `);
s1.on('end', function() { log('s1 ended') });
s2.on('end', function() { log('s2 ended') });
s3.on('end', function() { log('s3 ended') });
s3.map(n => `[${n}]`).pipe(process.stdout);
})();

Outputs:
[1][2][3] [s1 ended] [4][5][6] [s2 ended] undefined
Expected:
[s3 ended] to print to console too.

ps: I noticed that if I add another transform at the end ( s4 = s3.map(....); s4.on('end', ...)), that stream does emit "end".

thanks!

just tried:

var highland = require("highland");
(function() {
s1 = highland(['1', '2', '3']), s2 = highland(['4', '5', '6']), s3 = s1.concat(s2);
const log = s => process.stdout.write(` [${s}] `);
s1.observe().done(function() { log('s1 done') });
s2.observe().done(function() { log('s2 done') });
s3.observe().done(function() { log('s3 done') });
s3.map(n => `[${n}]`).pipe(process.stdout);
})();

but same results