fn run_seccompiler_bin(cargo_target: &str, json_path: &str, out_path: &str, basic: bool) {
    let target_arch = env::var("CARGO_CFG_TARGET_ARCH").expect("Missing target arch.");

    // Command for running seccompiler-bin
    let mut command = Command::new("cargo");
    command.args(&[
        "run",
        "-p",
        "seccompiler",
        "--verbose",
        "--target",
        &cargo_target,
        // We need to specify a separate build directory for seccompiler-bin. Otherwise, cargo will
        // deadlock waiting to acquire a lock on the build folder that the parent cargo process is
        // holding.
        "--target-dir",
        SECCOMPILER_BUILD_DIR,
        "--",
        "--input-file",
        &json_path,
        "--target-arch",
        &target_arch,
        "--output-file",
        out_path,
    ]);

    if basic {
        command.arg("--basic");
    }

    match command.output() {
        Err(error) => panic!("\nSeccompiler-bin error: {:?}\n", error),
        Ok(result) if !result.status.success() => {
            panic!(
                "\nSeccompiler-bin returned non-zero exit code:\nstderr: {}\nstdout: {}\n",
                String::from_utf8(result.stderr).unwrap(),
                String::from_utf8(result.stdout).unwrap(),
            );
        }
        Ok(_) => {}
    }
}
// Run seccompiler with the given arguments.
Run seccompiler with the given arguments.
Run seccompiler with the given arguments .
fn run_seccompiler_bin(cargo_target: &str, json_path: &str, out_path: &str, basic: bool) {
    let target_arch = env::var("CARGO_CFG_TARGET_ARCH").expect("Missing target arch.");
    // Command for running seccompiler-bin
    let mut command = Command::new("cargo");
    command.args(&[
        "run",
        "-p",
        "seccompiler",
        "--verbose",
        "--target",
        &cargo_target,
        // We need to specify a separate build directory for seccompiler-bin. Otherwise, cargo will
        // deadlock waiting to acquire a lock on the build folder that the parent cargo process is
        // holding.
        "--target-dir",
        SECCOMPILER_BUILD_DIR,
        "--",
        "--input-file",
        &json_path,
        "--target-arch",
        &target_arch,
        "--output-file",
        out_path,
    ]);
    if basic {
        command.arg("--basic");
    }
    match command.output() {
        Err(error) => panic!("\nSeccompiler-bin error: {:?}\n", error),
        Ok(result) if !result.status.success() => {
            panic!(
                "\nSeccompiler-bin returned non-zero exit code:\nstderr: {}\nstdout: {}\n",
                String::from_utf8(result.stderr).unwrap(),
                String::from_utf8(result.stdout).unwrap(),
            );
        }
        Ok(_) => {}
    }
}
fn run_seccompiler_bin ( cargo_target : & str , json_path : & str , out_path : & str , basic : bool ) { let target_arch = env :: var ( " " ) . expect ( " " ) ; // Command for running seccompiler-bin let mut command = Command :: new ( " " ) ; command . args ( & [ " " , " " , " " , " " , " " , & cargo_target , // We need to specify a separate build directory for seccompiler-bin. Otherwise, cargo will // deadlock waiting to acquire a lock on the build folder that the parent cargo process is // holding. " " , SECCOMPILER_BUILD_DIR , " " , " " , & json_path , " " , & target_arch , " " , out_path , ] ) ; if basic { command . arg ( " " ) ; } match command . output ( ) { Err ( error ) => panic ! ( " \n \n " error ) , Ok ( result ) if ! result . status . success ( ) => { panic ! ( " \n \n \n \n " String from_utf8 ( result stderr ) unwrap ( ) String from_utf8 ( result stdout ) unwrap ( ) ) ; } Ok ( _ ) => { } } }
Run seccompiler with the given arguments.
Run seccompiler with the given arguments .
cargo_target
&str
json_path
&str
out_path
&str
basic
bool
cargo_target
&str
json_path
&str
out_path
&str
basic
bool