Skip to content

Commit

Permalink
refactor: comment + call this.finish()
Browse files Browse the repository at this point in the history
  • Loading branch information
tpluscode committed Sep 19, 2024
1 parent 05e4109 commit 3af39ff
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/core/lib/Pipeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,11 @@ class Pipeline extends StreamObject<Stream & { pipeline?: Pipeline }> {
}

this.lastChild.stream.on('end', () => {
// in some cases, a duplex stream emits the end event but is still writable
// which prevents the pipeline from reaching the finished callback below
// in such case, a pipeline never finishes, and the process hangs
if (!isWritable(this.lastChild.stream) && !isReadable(this.lastChild.stream)) {
this.lastChild.stream.emit('finish')
this.finish()
}
})

Expand Down

0 comments on commit 3af39ff

Please sign in to comment.