is_proc_translated

Crates.iois_proc_translated
lib.rsis_proc_translated
version0.1.1
sourcesrc
created_at2022-10-07 16:04:12.778941
updated_at2022-10-07 16:25:47.245619
descriptionDetect if the current process is running as a translated binary under Rosetta
homepage
repositoryhttps://github.com/zertosh/is_proc_translated
max_upload_size
id682951
size16,531
Andres Suarez (zertosh)

documentation

https://docs.rs/is_proc_translated

README

is_proc_translated

github crates.io docs.rs

Detect if the current process is running as a translated binary under Rosetta.

[dependencies]
is_proc_translated = "0.1"

Using is_proc_translated

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}");
}

License

Licensed under either of Apache License, Version 2.0 or MIT license at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
Commit count: 5

cargo fmt