Skip to content

Commit

Permalink
add watch logic back
Browse files Browse the repository at this point in the history
  • Loading branch information
johnnynotsolucky committed Aug 17, 2023
1 parent 08d362d commit c8a2d78
Showing 1 changed file with 18 additions and 19 deletions.
37 changes: 18 additions & 19 deletions sluggy/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,25 +140,24 @@ impl Command {
}
}
});
serve_handle.await?

// let watch_handle = tokio::spawn({
// let server_config = server_config.clone();
// async move {
// if server_config.clone().watch {
// if let Err(error) = watcher.watch().await {
// println!("Error: {error}");
// }
// } else {
// futures::pending!()
// }
// }
// });
//
// select! {
// _ = serve_handle => {},
// _ = watch_handle => {},
// }

let watch_handle = tokio::spawn({
let server_config = server_config.clone();
async move {
if server_config.clone().watch {
if let Err(error) = watcher.watch().await {
println!("Error: {error}");
}
} else {
futures::pending!()
}
}
});

select! {
_ = serve_handle => {},
_ = watch_handle => {},
}
}
}

Expand Down

0 comments on commit c8a2d78

Please sign in to comment.