Skip to content

Commit

Permalink
cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
tjk committed Nov 20, 2024
1 parent fd410ab commit 38bb621
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/serve.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::process::Command;
use std::time::Duration;
use std::time::Instant;
use std::process::Command;

use actix_files::Files;
use actix_web::middleware::Logger;
Expand Down Expand Up @@ -38,7 +38,8 @@ impl Server {
if let Ok(event) = res {
let _ = tx.send(event);
}
}).unwrap();
})
.unwrap();

// Watch relevant directories
for dir in ["posts", "templates", "static"].iter() {
Expand Down Expand Up @@ -68,7 +69,7 @@ impl Server {
Ok(status) if status.success() => {
println!("✨ Site rebuilt successfully!");
last_build = Instant::now();
},
}
Ok(status) => eprintln!("Build failed with status: {}", status),
Err(e) => eprintln!("Failed to execute build: {}", e),
}
Expand Down Expand Up @@ -97,7 +98,11 @@ impl Server {
}
}

pub fn serve(dist_dir: PathBuf, port: u16, hot_reload: bool) -> Result<(), Box<dyn std::error::Error>> {
pub fn serve(
dist_dir: PathBuf,
port: u16,
hot_reload: bool,
) -> Result<(), Box<dyn std::error::Error>> {
if !dist_dir.exists() {
return Err(format!(
"Directory not found: {}. Run `term-v build` first.",
Expand Down

0 comments on commit 38bb621

Please sign in to comment.