Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 2 commits into from
Dec 22, 2020

Conversation

JoelEinbinder
Copy link
Contributor

@JoelEinbinder JoelEinbinder commented Dec 21, 2020

os.arch() returns "x64" on all platforms. uname -u returns i386 when called from node. However sysctl tells us the real architecture, even if we are running under Rosetta.

Depending on how we merge this into a release, we should also bump the browser number.

@yury-s
Copy link
Member

yury-s commented Dec 21, 2020

Is this specific to Node 14? In Node 15 os.arch() returns 'arm64'.

@@ -35,7 +35,10 @@ 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' : '';
const arm64 = execSync('sysctl -in hw.optional.arm64', {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's restrain this method to macOS 11+ and Node <15 ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Node 15 reports 'x64' unless you compile it yourself.

@JoelEinbinder
Copy link
Contributor Author

as per discussion with dgozman offline, added a check that doesn't run this code unless you are on macos 11 or higher.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants