-
-
Notifications
You must be signed in to change notification settings - Fork 33.5k
Closed
Labels
streamIssues and PRs related to the stream subsystem.Issues and PRs related to the stream subsystem.
Description
- Version: v11.11.0
- Platform: Linux 3.10.0-693.21.1.el7.x86_64
- Subsystem:
Below is a simple example of a pipeline starting with a Readable, Transform, and then process.stdout. Failures in the Transform do not get reported by Stream.pipeline.
const { Transform, Readable, pipeline } = require('stream')
const reader = new Readable({
read(size) { this.push("foo") }
})
let count = 0;
const transform = new Transform({
transform(chunk, enc, cb) {
if (count++ >= 5)
this.emit("error", new Error("this-error-gets-hidden"))
else
cb(null, count.toString() + "\n")
}
})
pipeline(
reader,
transform,
process.stdout,
e => e ? console.error(e) : console.log("done")
)
The error that is emitted never shows up in the pipeline's callback. The pipeline does stop on the 5th iteration as expected, but the error gets gobbled up somehow. If process.stdout is removed from the pipeline, the error is displayed as expected.
Interestingly, the following works as expected:
pipeline(
reader,
transform,
e => e ? console.error(e) : console.log("done")
).pipe(
process.stdout
)
craigphicks and raszi
Metadata
Metadata
Assignees
Labels
streamIssues and PRs related to the stream subsystem.Issues and PRs related to the stream subsystem.