fix(android): do not report all artifactsDirs as errors (#35530)

This commit is contained in:
Max Schmitt 2025-04-08 11:08:21 +01:00 committed by GitHub
parent 265e733752
commit 3b70f95b17
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 2 deletions

View File

@ -323,7 +323,7 @@ export class AndroidDevice extends SdkObject {
const artifactsDir = await fs.promises.mkdtemp(ARTIFACTS_FOLDER);
const cleanupArtifactsDir = async () => {
const errors = await removeFolders([artifactsDir]);
const errors = (await removeFolders([artifactsDir])).filter(Boolean);
for (let i = 0; i < (errors || []).length; ++i)
debug('pw:android')(`exception while removing ${artifactsDir}: ${errors[i]}`);
};

View File

@ -29,7 +29,7 @@ export async function mkdirIfNeeded(filePath: string) {
await fs.promises.mkdir(path.dirname(filePath), { recursive: true }).catch(() => {});
}
export async function removeFolders(dirs: string[]): Promise<Error[]> {
export async function removeFolders(dirs: string[]): Promise<(Error| undefined)[]> {
return await Promise.all(dirs.map((dir: string) =>
fs.promises.rm(dir, { recursive: true, force: true, maxRetries: 10 }).catch(e => e)
));