Skip to content

Commit

Permalink
fix: handle end and finish events
Browse files Browse the repository at this point in the history
  • Loading branch information
tpluscode committed Sep 19, 2024
1 parent 44377ac commit 63295b6
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 @@ -116,8 +116,11 @@ class Pipeline extends StreamObject<Stream & { pipeline?: Pipeline }> {
this.children[index].stream.pipe(child.stream)
}

const finished = once(() => this.finish())

this.lastChild.stream.on('error', this.logger.error.bind(this.logger))
this.lastChild.stream.on('end', this.finish.bind(this))
this.lastChild.stream.on('end', finished)
this.lastChild.stream.on('finish', finished)
} catch (err: any) { // eslint-disable-line @typescript-eslint/no-explicit-any
this.destroy(err)

Expand Down

0 comments on commit 63295b6

Please sign in to comment.