Skip to content

Commit

Permalink
fix: use win64 version of chromium when on arm64 windows (#8927)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
robrobrobrob committed Sep 19, 2022
1 parent 6f37eed commit 64843b8
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion src/node/BrowserFetcher.ts
Expand Up @@ -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);
Expand Down Expand Up @@ -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
*/
Expand Down

0 comments on commit 64843b8

Please sign in to comment.