2021-08-21 11:12:40 +02:00
|
|
|
use std::time::Duration;
|
|
|
|
|
|
|
|
use tokio::time::sleep;
|
|
|
|
use watchexec::{
|
2021-08-22 10:49:24 +02:00
|
|
|
config::{InitConfigBuilder, RuntimeConfig},
|
2021-08-21 11:12:40 +02:00
|
|
|
Watchexec,
|
|
|
|
};
|
|
|
|
|
|
|
|
#[tokio::main]
|
|
|
|
async fn main() -> color_eyre::eyre::Result<()> {
|
|
|
|
tracing_subscriber::fmt::init();
|
|
|
|
color_eyre::install()?;
|
|
|
|
|
|
|
|
let init = InitConfigBuilder::default()
|
|
|
|
.error_handler(Box::new(|err| async move {
|
|
|
|
eprintln!("Watchexec Runtime Error: {}", err);
|
|
|
|
Ok::<(), std::convert::Infallible>(())
|
|
|
|
}))
|
|
|
|
.build()?;
|
|
|
|
|
2021-08-22 10:49:24 +02:00
|
|
|
let runtime = RuntimeConfig::default();
|
2021-08-21 11:12:40 +02:00
|
|
|
|
|
|
|
let wx = Watchexec::new(init, runtime)?;
|
|
|
|
wx.main();
|
|
|
|
|
|
|
|
// TODO: induce an error here
|
|
|
|
|
|
|
|
sleep(Duration::from_secs(1)).await;
|
|
|
|
|
|
|
|
Ok(())
|
|
|
|
}
|