From b593d1deb4823fe44c75a84ad7ab3547753ec920 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 --- packages/artifact/src/internal/download-http-client.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/artifact/src/internal/download-http-client.ts b/packages/artifact/src/internal/download-http-client.ts index bd409ebb..e090c547 100644 --- a/packages/artifact/src/internal/download-http-client.ts +++ b/packages/artifact/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', () => {