Skip to content

Commit

Permalink
Clean up credentials.toml
Browse files Browse the repository at this point in the history
  • Loading branch information
Swatinem committed Aug 2, 2023
1 parent 5ec9842 commit 80c47cc
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
7 changes: 7 additions & 0 deletions dist/restore/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -67272,6 +67272,13 @@ async function cleanBin(oldBins) {
}
}
async function cleanRegistry(packages, crates = true) {
// remove `.cargo/credentials.toml`
try {
const credentials = path.join(CARGO_HOME, ".cargo", "credentials.toml");
core.debug(`deleting "${credentials}"`);
await fs.promises.unlink(credentials);
}
catch { }
// `.cargo/registry/index`
let pkgSet = new Set(packages.map((p) => p.name));
const indexDir = await fs.promises.opendir(path.join(CARGO_HOME, "registry", "index"));
Expand Down
7 changes: 7 additions & 0 deletions dist/save/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -67272,6 +67272,13 @@ async function cleanBin(oldBins) {
}
}
async function cleanRegistry(packages, crates = true) {
// remove `.cargo/credentials.toml`
try {
const credentials = external_path_default().join(CARGO_HOME, ".cargo", "credentials.toml");
core.debug(`deleting "${credentials}"`);
await external_fs_default().promises.unlink(credentials);
}
catch { }
// `.cargo/registry/index`
let pkgSet = new Set(packages.map((p) => p.name));
const indexDir = await external_fs_default().promises.opendir(external_path_default().join(CARGO_HOME, "registry", "index"));
Expand Down
7 changes: 7 additions & 0 deletions src/cleanup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,13 @@ export async function cleanBin(oldBins: Array<string>) {
}

export async function cleanRegistry(packages: Packages, crates = true) {
// remove `.cargo/credentials.toml`
try {
const credentials = path.join(CARGO_HOME, ".cargo", "credentials.toml");
core.debug(`deleting "${credentials}"`);
await fs.promises.unlink(credentials);
} catch {}

// `.cargo/registry/index`
let pkgSet = new Set(packages.map((p) => p.name));
const indexDir = await fs.promises.opendir(path.join(CARGO_HOME, "registry", "index"));
Expand Down

0 comments on commit 80c47cc

Please sign in to comment.