mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
fix: use win64 version of chromium when on arm64 windows (#8927)
* fix: use win64 version of chromium when on arm64 windows no Win_arm available on storage.googleapis.com yet, and it currently defaults to win32 * fix: lint trailing space * fix: use x64 chromium on Windows 11 for ARM * fix: detect windows 11 without semver
This commit is contained in:
parent
6f37eed91b
commit
64843b8885
@ -237,7 +237,12 @@ export class BrowserFetcher {
|
||||
this.#platform = 'linux';
|
||||
break;
|
||||
case 'win32':
|
||||
this.#platform = os.arch() === 'x64' ? 'win64' : 'win32';
|
||||
this.#platform =
|
||||
os.arch() === 'x64' ||
|
||||
// Windows 11 for ARM supports x64 emulation
|
||||
(os.arch() === 'arm64' && _isWindows11(os.release()))
|
||||
? 'win64'
|
||||
: 'win32';
|
||||
return;
|
||||
default:
|
||||
assert(false, 'Unsupported platform: ' + platform);
|
||||
@ -497,6 +502,25 @@ function parseFolderPath(
|
||||
return {product, platform, revision};
|
||||
}
|
||||
|
||||
/**
|
||||
* Windows 11 is identified by 10.0.22000 or greater
|
||||
* @internal
|
||||
*/
|
||||
function _isWindows11(version: string): boolean {
|
||||
const parts = version.split('.');
|
||||
if (parts.length > 2) {
|
||||
const major = parseInt(parts[0] as string, 10);
|
||||
const minor = parseInt(parts[1] as string, 10);
|
||||
const patch = parseInt(parts[2] as string, 10);
|
||||
return (
|
||||
major > 10 ||
|
||||
(major === 10 && minor > 0) ||
|
||||
(major === 10 && minor === 0 && patch >= 22000)
|
||||
);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user