mod local_driver;
mod recent_frames;
pub(crate) const INTERNAL_SENTINEL: &str = "__auv-internal-runner";
pub(crate) const LOCAL_DRIVER_ROLE: &str = "local-driver";
pub(crate) const STATE_ROOT_ENV: &str = "AUV_RUNNER_STATE_ROOT";
pub fn run_if_internal(arguments: &[String]) -> Option<i32> {
if arguments.get(1).is_none_or(|argument| argument != INTERNAL_SENTINEL) {
return None;
}
Some(match arguments {
[_, _, role] if role == LOCAL_DRIVER_ROLE => run_local_driver(),
_ => {
eprintln!("invalid internal AUV Runner invocation");
2
}
})
}
fn run_local_driver() -> i32 {
let runtime = tokio::runtime::Builder::new_current_thread().enable_all().build().expect("build local Runner runtime");
match runtime.block_on(local_driver::serve_inherited()) {
Ok(()) => 0,
Err(error) => {
eprintln!("AUV local driver Runner failed: {error}");
1
}
}
}