use anyhow::Result; use goose_cli::cli::cli; async fn run() -> Result<()> { if let Err(e) = goose_cli::logging::setup_logging(None) { eprintln!("Warning: Failed to initialize logging: {}", e); } let result = cli().await; #[cfg(feature = "otel")] if goose::otel::otlp::is_otlp_initialized() { tokio::time::sleep(tokio::time::Duration::from_millis(100)).await; goose::otel::otlp::shutdown_otlp(); } result } fn main() -> Result<()> { let handle = std::thread::Builder::new() .name("goose-cli-main".to_string()) .stack_size(8 * 1024 * 1024) .spawn(|| { let runtime = tokio::runtime::Builder::new_multi_thread() .enable_all() .build() .expect("Failed to build Tokio runtime"); runtime.block_on(run()) }) .map_err(|e| anyhow::anyhow!("Failed to spawn goose-cli main thread: {}", e))?; handle .join() .map_err(|_| anyhow::anyhow!("goose-cli main thread panicked"))? }