pump swallowing errors when read stream is empty
coderaiser opened this issue · 2 comments
coderaiser commented
pump
has inconsistent behavior with pipe
, it is swallows writable errors, when readable stream is empty, for example, such code will log undefined
:
const {Readable} = require('stream');
const {createWriteStream} = require('fs');
const pump = require('pump');
const inStream = new Readable({
read() {}
});
inStream.push(null);
pump(inStream, createWriteStream('/'), console.log);
And this one will show an error:
const {Readable} = require('stream');
const {createWriteStream} = require('fs');
const pump = require('pump');
const inStream = new Readable({
read() {}
});
inStream.push(null);
inStream.pipe(createWriteStream('/'));
This relates to nodejs/node#24517
mcollina commented
It is the exact same issue, and see my long explanation there. I'm almost certain @mafintosh thinks the same way.