use std::ffi::CString;
use std::path::Path;
pub fn exec_with_interp(executable: &Path, interpreter: &Path, argv0: &str, args: &[String]) -> ! {
let mut options = userland_execve::ExecOptions::new(executable);
let argv0_c = CString::new(argv0).unwrap();
options.arg(&argv0_c);
for arg in args {
let arg_c = CString::new(arg.as_str()).unwrap();
options.arg(&arg_c);
}
for (key, value) in std::env::vars() {
let key_c = CString::new(key).unwrap();
let value_c = CString::new(value).unwrap();
options.env(&key_c, &value_c);
}
options.override_interpreter(Some(interpreter));
userland_execve::exec_with_options(options)
}
pub const fn is_supported() -> bool {
cfg!(all(
target_os = "linux",
any(target_arch = "x86_64", target_arch = "aarch64")
))
}