mirror of
https://github.com/watchexec/watchexec.git
synced 2024-11-16 17:18:30 +01:00
d7d549a4c8
It's not exactly a builder, and this lets us flatten all the options at the top level instead of requiring the user to dig deeper into the action, fs, etc modules' WorkingData structs.
29 lines
648 B
Rust
29 lines
648 B
Rust
use std::time::Duration;
|
|
|
|
use tokio::time::sleep;
|
|
use watchexec::{
|
|
config::{InitConfigBuilder, RuntimeConfig},
|
|
Watchexec,
|
|
};
|
|
|
|
// Run with: `env RUST_LOG=debug cargo run --example print_out`
|
|
#[tokio::main]
|
|
async fn main() -> color_eyre::eyre::Result<()> {
|
|
tracing_subscriber::fmt::init();
|
|
color_eyre::install()?;
|
|
|
|
let mut init = InitConfigBuilder::default();
|
|
init.on_error(|err| async move {
|
|
eprintln!("Watchexec Runtime Error: {}", err);
|
|
Ok::<(), std::convert::Infallible>(())
|
|
});
|
|
|
|
let runtime = RuntimeConfig::default();
|
|
|
|
let wx = Watchexec::new(init.build()?, runtime)?;
|
|
wx.main();
|
|
|
|
sleep(Duration::from_secs(1)).await;
|
|
|
|
Ok(())
|
|
}
|