mirror of
https://github.com/moonrepo/setup-rust.git
synced 2025-04-29 21:40:01 +00:00
fix: Dont error on missing index dir.
This commit is contained in:
parent
aaa9e56585
commit
8e43d3720d
2 changed files with 12 additions and 10 deletions
20
src/cargo.ts
20
src/cargo.ts
|
@ -132,17 +132,19 @@ export async function cleanCargoRegistry() {
|
|||
// .cargo/registry/index - Delete .cache directories
|
||||
const indexDir = path.join(registryDir, 'index');
|
||||
|
||||
for (const index of fs.readdirSync(indexDir)) {
|
||||
if (fs.existsSync(path.join(indexDir, index, '.git'))) {
|
||||
const dir = path.join(indexDir, index, '.cache');
|
||||
if (fs.existsSync(indexDir)) {
|
||||
for (const index of fs.readdirSync(indexDir)) {
|
||||
if (fs.existsSync(path.join(indexDir, index, '.git'))) {
|
||||
const dir = path.join(indexDir, index, '.cache');
|
||||
|
||||
core.debug(`Deleting ${dir}`);
|
||||
core.debug(`Deleting ${dir}`);
|
||||
|
||||
try {
|
||||
// eslint-disable-next-line no-await-in-loop
|
||||
await io.rmRF(dir);
|
||||
} catch (error: unknown) {
|
||||
core.warning(`Failed to delete ${dir}: ${error}`);
|
||||
try {
|
||||
// eslint-disable-next-line no-await-in-loop
|
||||
await io.rmRF(dir);
|
||||
} catch (error: unknown) {
|
||||
core.warning(`Failed to delete ${dir}: ${error}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue