From b0e869b5c36a94a62d739b2aec88a370c06a21e1 Mon Sep 17 00:00:00 2001 From: haopeng Date: Fri, 26 Aug 2022 18:14:49 +0800 Subject: [PATCH] fix: close file stream when error --- packages/builder-util-runtime/src/httpExecutor.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/builder-util-runtime/src/httpExecutor.ts b/packages/builder-util-runtime/src/httpExecutor.ts index 0bca9b0c377..45aab528b9a 100644 --- a/packages/builder-util-runtime/src/httpExecutor.ts +++ b/packages/builder-util-runtime/src/httpExecutor.ts @@ -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) }