|
1 | 1 | import path, { join, basename as basename$1, dirname } from 'node:path'; |
2 | 2 | import process$1, { env, chdir, exit } from 'node:process'; |
3 | 3 | import require$$1$6, { stripVTControlCharacters, promisify, isDeepStrictEqual } from 'node:util'; |
4 | | -import { mkdir as mkdir$1, mkdtemp, rm, readFile as readFile$1, access } from 'node:fs/promises'; |
| 4 | +import { mkdir as mkdir$1, mkdtempDisposable, readFile as readFile$1, access } from 'node:fs/promises'; |
5 | 5 | import require$$1$8, { tmpdir, homedir } from 'node:os'; |
6 | 6 | import fs$1, { existsSync, appendFileSync } from 'node:fs'; |
7 | 7 | import require$$0$4 from 'util'; |
@@ -59025,21 +59025,17 @@ class ToolManager { |
59025 | 59025 | const { size: assetSize, name: assetName } = assetDescriptor.asset; |
59026 | 59026 | logger.info(`Attempting to download '${assetName}' (${humanReadableSize(assetSize)})`); |
59027 | 59027 | const result = { version: this.versionOrPredicate }; |
59028 | | - const tempdir = await mkdtemp(join(tmpdir(), `${pkg.name}-`)); |
| 59028 | + const tempdir = await mkdtempDisposable(join(tmpdir(), `${pkg.name}-`)); |
59029 | 59029 | await ensureExists(installDir); |
59030 | | - try { |
59031 | | - const compressedArchive = join(tempdir, assetDescriptor.asset.name); |
59032 | | - await download(assetDescriptor.asset.browser_download_url, compressedArchive, assetSize); |
59033 | | - await decompressCommonFormats(compressedArchive, installDir, { |
59034 | | - filter: (file) => basename$1(file.path) == binaryName, |
59035 | | - strip: 5 |
59036 | | - // fixme: figure this value out |
59037 | | - }).then( |
59038 | | - (files) => files.length == 0 ? Promise.reject(`Could not find binary '${binaryName}' in downloaded artifact`) : Promise.resolve(files) |
59039 | | - ).then(() => result.path = join(installDir, binaryName)).catch((err) => void logger.error(err)); |
59040 | | - } finally { |
59041 | | - await rm(tempdir, { recursive: true }); |
59042 | | - } |
| 59030 | + const compressedArchive = join(tempdir.path, assetDescriptor.asset.name); |
| 59031 | + await download(assetDescriptor.asset.browser_download_url, compressedArchive, assetSize); |
| 59032 | + await decompressCommonFormats(compressedArchive, installDir, { |
| 59033 | + filter: (file) => basename$1(file.path) == binaryName, |
| 59034 | + strip: 5 |
| 59035 | + // fixme: figure this value out |
| 59036 | + }).then( |
| 59037 | + (files) => files.length == 0 ? Promise.reject(`Could not find binary '${binaryName}' in downloaded artifact`) : Promise.resolve(files) |
| 59038 | + ).then(() => result.path = join(installDir, binaryName)).catch((err) => void logger.error(err)); |
59043 | 59039 | return result; |
59044 | 59040 | } |
59045 | 59041 | async findCompatibleAsset() { |
|
0 commit comments