use std::process::ExitCode;
#[cfg(all(windows, debug_assertions))]
const MAIN_STACK: usize = 8 * 1024 * 1024;
#[cfg(all(windows, debug_assertions))]
fn main() -> ExitCode {
std::thread::Builder::new()
.name("rpi-main".to_string())
.stack_size(MAIN_STACK)
.spawn(run)
.expect("failed to spawn rpi-main")
.join()
.unwrap_or(ExitCode::FAILURE)
}
#[cfg(not(all(windows, debug_assertions)))]
fn main() -> ExitCode {
run()
}
fn run() -> ExitCode {
let runtime = tokio::runtime::Builder::new_multi_thread()
.enable_all()
.build()
.expect("failed to build tokio runtime");
let code = runtime.block_on(rpi_cli::app::run());
ExitCode::from(code as u8)
}