fix(webkit): properly detect arm64 on apple silicon (#4783)

This commit is contained in:
Joel Einbinder 2020-12-21 16:37:55 -08:00 committed by GitHub
parent 73edf13ad6
commit ff2a1f1bd0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -35,7 +35,13 @@ export const hostPlatform = ((): BrowserPlatform => {
const macVersion = execSync('sw_vers -productVersion', {
stdio: ['ignore', 'pipe', 'ignore']
}).toString('utf8').trim().split('.').slice(0, 2).join('.');
const archSuffix = os.arch() === 'arm64' ? '-arm64' : '';
let arm64 = false;
if (!macVersion.startsWith('10.')) {
arm64 = execSync('sysctl -in hw.optional.arm64', {
stdio: ['ignore', 'pipe', 'ignore']
}).toString().trim() === '1';
}
const archSuffix = arm64 ? '-arm64' : '';
return `mac${macVersion}${archSuffix}` as BrowserPlatform;
}
if (platform === 'linux') {