Skip to content

Commit 8225573

Browse files
committed
fix(registry): create unique browser download path
This allows concurrent downloads of browsers by Playwright. Fixes #32179
1 parent 9b6176d commit 8225573

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

packages/playwright-core/src/server/registry/browserFetcher.ts

+5-2
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ export async function downloadBrowserWithProgressBar(title: string, browserDirec
3737
return false;
3838
}
3939

40-
const zipPath = path.join(os.tmpdir(), downloadFileName);
40+
const downloadFolder = await fs.promises.mkdtemp(path.join(os.tmpdir(), 'playwright-download-'));
41+
const zipPath = path.join(downloadFolder, downloadFileName);
4142
try {
4243
const retryCount = 5;
4344
for (let attempt = 1; attempt <= retryCount; ++attempt) {
@@ -49,8 +50,10 @@ export async function downloadBrowserWithProgressBar(title: string, browserDirec
4950
debugLogger.log('install', `SUCCESS installing ${title}`);
5051
break;
5152
}
52-
if (await existsAsync(zipPath))
53+
if (await existsAsync(zipPath)) {
5354
await fs.promises.unlink(zipPath);
55+
await fs.promises.rmdir(downloadFolder, { recursive: true });
56+
}
5457
if (await existsAsync(browserDirectory))
5558
await fs.promises.rmdir(browserDirectory, { recursive: true });
5659
const errorMessage = error?.message || '';

0 commit comments

Comments
 (0)