Skip to content

Commit

Permalink
stream: fix pipeline with dest in objectMode
Browse files Browse the repository at this point in the history
pipeline did not support destination with generator
that does not return strings or buffers.

PR-URL: #32414
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
  • Loading branch information
ronag committed Mar 25, 2020
1 parent 9e3eddc commit 05f1df5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/internal/streams/pipeline.js
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,9 @@ function pipeline(...streams) {
// always returns a stream which can be further
// composed through `.pipe(stream)`.

const pt = new PassThrough();
const pt = new PassThrough({
objectMode: true
});
if (isPromise(ret)) {
ret
.then((val) => {
Expand Down
12 changes: 12 additions & 0 deletions test/parallel/test-stream-pipeline.js
Original file line number Diff line number Diff line change
Expand Up @@ -1065,3 +1065,15 @@ const { promisify } = require('util');
src.push('asd');
dst.destroy();
}

{
pipeline(async function * () {
yield 'asd';
}, async function * (source) {
for await (const chunk of source) {
yield { chunk };
}
}, common.mustCall((err) => {
assert.ifError(err);
}));
}

0 comments on commit 05f1df5

Please sign in to comment.