From 0d9c48db408d1998dcc5cf569efd53a4e38979e7 Mon Sep 17 00:00:00 2001 From: zyl Date: Fri, 8 Nov 2024 18:23:18 -0800 Subject: [PATCH] fix building without serve feature --- src/main.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main.rs b/src/main.rs index be64753..f72ebda 100644 --- a/src/main.rs +++ b/src/main.rs @@ -91,8 +91,7 @@ enum ResourceCommands { }, } -#[tokio::main] -async fn main() -> eyre::Result<()> { +fn main() -> eyre::Result<()> { #[cfg(feature = "color-eyre")] color_eyre::install()?; @@ -136,7 +135,8 @@ async fn main() -> eyre::Result<()> { #[cfg(feature = "serve")] Commands::Serve { ip, port } => { let site = site()?; - site.serve(&format!("{}:{}", ip, port)).await + let rt = tokio::runtime::Runtime::new()?; + rt.block_on(async move { site.serve(&format!("{}:{}", ip, port)).await }) } Commands::Now => { let time = OffsetDateTime::now_utc();