mirror of
https://github.com/watchexec/watchexec.git
synced 2024-11-16 09:08:37 +01:00
32 lines
652 B
Rust
32 lines
652 B
Rust
|
use std::time::Duration;
|
||
|
|
||
|
use tokio::time::sleep;
|
||
|
use watchexec::{
|
||
|
config::{InitConfigBuilder, RuntimeConfigBuilder},
|
||
|
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()?;
|
||
|
|
||
|
let runtime = RuntimeConfigBuilder::default().build()?;
|
||
|
|
||
|
let wx = Watchexec::new(init, runtime)?;
|
||
|
wx.main();
|
||
|
|
||
|
// TODO: induce an error here
|
||
|
|
||
|
sleep(Duration::from_secs(1)).await;
|
||
|
|
||
|
Ok(())
|
||
|
}
|