Fix Node hooks on Apple Silicon

Fixed: 1494447
Change-Id: Ie80af8e1302517640c1433cdf62d2d22651b75e1
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/4989682
Commit-Queue: Alex Rudenko <alexrudenko@chromium.org>
Reviewed-by: Simon Zünd <szuend@chromium.org>
Reviewed-by: Alex Rudenko <alexrudenko@chromium.org>
This commit is contained in:
Moti Zilberman
2023-10-31 12:13:31 +00:00
committed by Devtools-frontend LUCI CQ
parent fa47345230
commit e2bc335ce7
2 changed files with 20 additions and 2 deletions
+11 -1
View File
@@ -10,10 +10,20 @@ import sys
import os
def get_mac_architecture():
if platform.machine() == "x86_64":
is_translated = subprocess.run(
["sysctl", "-n", "sysctl.proc_translated"],
capture_output=True,
text=True).stdout.strip() == "1"
return "arm64" if is_translated else "x86_64"
return platform.machine()
def GetBinaryPath():
return os_path.join(
os_path.dirname(__file__), *{
'Darwin': ('mac', 'node-darwin-arm64' if platform.machine()
'Darwin': ('mac', 'node-darwin-arm64' if get_mac_architecture()
== 'arm64' else 'node-darwin-x64', 'bin', 'node'),
'Linux': ('linux', 'node-linux-x64', 'bin', 'node'),
'Windows': ('win', 'node.exe'),