Skip to content

Commit

Permalink
fix: close file stream when error
Browse files Browse the repository at this point in the history
  • Loading branch information
haopeng committed Aug 26, 2022
1 parent 48cbb12 commit b0e869b
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions packages/builder-util-runtime/src/httpExecutor.ts
Expand Up @@ -485,9 +485,8 @@ function configurePipes(options: DownloadCallOptions, response: IncomingMessage)
let lastStream = response
for (const stream of streams) {
stream.on("error", (error: Error) => {
if (!options.options.cancellationToken.cancelled) {
options.callback(error)
}
fileOut.close()
options.callback(error)
})
lastStream = lastStream.pipe(stream)
}
Expand Down

0 comments on commit b0e869b

Please sign in to comment.