From 6f33e4c7b00e85e23dd03740e3c7887e7816d823 Mon Sep 17 00:00:00 2001 From: Yang Cao Date: Fri, 4 Dec 2020 11:03:17 -0500 Subject: [PATCH] Close destination steam before reject Co-authored-by: Chris Sidi --- src/internal/download-http-client.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/internal/download-http-client.ts b/src/internal/download-http-client.ts index bd409eb..e090c54 100644 --- a/src/internal/download-http-client.ts +++ b/src/internal/download-http-client.ts @@ -315,16 +315,17 @@ export class DownloadHttpClient { core.error( `An error occurred while attempting to read the response stream` ) - reject(error) gunzip.close() + destinationStream.close() + reject(error) }) .pipe(gunzip) .on('error', error => { core.error( `An error occurred while attempting to decompress the response stream` ) - reject(error) destinationStream.close() + reject(error) }) .pipe(destinationStream) .on('close', () => { @@ -342,8 +343,8 @@ export class DownloadHttpClient { core.error( `An error occurred while attempting to read the response stream` ) - reject(error) destinationStream.close() + reject(error) }) .pipe(destinationStream) .on('close', () => {