DevelopmentNodeEnvironment_MicrosoftVSCodeDependency_22NodeVersion_Bundle_Clean_Debug_ElectronProfile_EsbuildCompiler_Mountain/IPC/WindServiceHandlers/NativeHost/
IsRunningUnderARM64Translation.rs1use serde_json::{Value, json};
6
7pub async fn Fn() -> Result<Value, String> {
8 #[cfg(target_os = "macos")]
9 {
10 static ROSETTA:std::sync::OnceLock<bool> = std::sync::OnceLock::new();
12
13 let IsTranslated = *ROSETTA.get_or_init(|| {
14 std::process::Command::new("sysctl")
15 .args(["-n", "sysctl.proc_translated"])
16 .output()
17 .ok()
18 .map(|O| String::from_utf8_lossy(&O.stdout).trim() == "1")
19 .unwrap_or(false)
20 });
21
22 Ok(json!(IsTranslated))
23 }
24
25 #[cfg(not(target_os = "macos"))]
26 {
27 Ok(json!(false))
28 }
29}