Avoid leftover files by using temp dir (#150)

Fixes: #149
This commit is contained in:
Kevin Stillhammer 2024-11-06 12:52:46 +01:00 committed by GitHub
parent a7e15805d2
commit 2e657c127d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 18 additions and 8 deletions

View file

@ -23,13 +23,15 @@ export async function downloadLatest(
const downloadPath = await tc.downloadTool(
downloadUrl,
`${artifact}${extension}`,
undefined,
githubToken,
);
let uvExecutablePath: string;
let uvDir: string;
if (platform === "pc-windows-msvc") {
uvDir = await tc.extractZip(downloadPath);
const fullPathWithExtension = `${downloadPath}${extension}`;
await fs.copyFile(downloadPath, fullPathWithExtension);
uvDir = await tc.extractZip(fullPathWithExtension);
// On windows extracting the zip does not create an intermediate directory
uvExecutablePath = path.join(uvDir, "uv.exe");
} else {

View file

@ -40,7 +40,7 @@ export async function downloadVersion(
const downloadPath = await tc.downloadTool(
downloadUrl,
`${artifact}${extension}`,
undefined,
githubToken,
);
await validateChecksum(
@ -53,7 +53,9 @@ export async function downloadVersion(
let uvDir: string;
if (platform === "pc-windows-msvc") {
uvDir = await tc.extractZip(downloadPath);
const fullPathWithExtension = `${downloadPath}${extension}`;
await fs.copyFile(downloadPath, fullPathWithExtension);
uvDir = await tc.extractZip(fullPathWithExtension);
// On windows extracting the zip does not create an intermediate directory
} else {
const extractedDir = await tc.extractTar(downloadPath);