Crates.io | is_proc_translated |
lib.rs | is_proc_translated |
version | 0.1.1 |
source | src |
created_at | 2022-10-07 16:04:12.778941 |
updated_at | 2022-10-07 16:25:47.245619 |
description | Detect if the current process is running as a translated binary under Rosetta |
homepage | |
repository | https://github.com/zertosh/is_proc_translated |
max_upload_size | |
id | 682951 |
size | 16,531 |
Detect if the current process is running as a translated binary under
Rosetta
.
[dependencies]
is_proc_translated = "0.1"
use std::process::Command;
use is_proc_translated::is_proc_translated;
fn main() {
// Force executing the arm64 slice of a Universal Binary.
let status = if is_proc_translated() {
Command::new("arch")
.arg("-arm64")
.arg("buck")
.arg("build")
.status()
.expect("failed to execute process")
} else {
Command::new("buck")
.arg("build")
.status()
.expect("failed to execute process")
};
println!("process finished with: {status}");
}