diff --git a/packages/tool-cache/src/archive/get-archive-type.ts b/packages/tool-cache/src/archive/get-archive-type.ts index a8b9bde6..26ad06ef 100644 --- a/packages/tool-cache/src/archive/get-archive-type.ts +++ b/packages/tool-cache/src/archive/get-archive-type.ts @@ -70,20 +70,14 @@ export const getArchiveType = async (filePath: string): Promise => const readStream = readStreamFromDescriptor(fd) const closeEverythingAndResolve = (result: ArchiveType): void => { - readStream.close(() => { - fs.close(fd, () => resolve(result as '7z' | 'zip' | 'xar' | 'tar')) - }) + readStream.close() + fs.close(fd, () => resolve(result as '7z' | 'zip' | 'xar' | 'tar')) readStream.push(null) } const closeEverythingAndReject = (error?: Error): void => { - readStream.close(() => { - fs.close(fd, () => - reject( - error ?? Error(`Unable to determine archive type of ${filePath}`) - ) - ) - }) + readStream.close() + fs.close(fd, () => reject(error ?? Error('Unable to read file'))) readStream.push(null) }