mirror of
https://github.com/exoticorn/microw8.git
synced 2026-01-20 19:26:43 +01:00
add watchdog to interupt hanging update
This commit is contained in:
@@ -28,7 +28,7 @@ fn main() -> Result<()> {
|
||||
println!("uw8 {}", env!("CARGO_PKG_VERSION"));
|
||||
println!();
|
||||
println!("Usage:");
|
||||
println!(" uw8 run [-w/--watch] [-p/--pack] [-u/--uncompressed] [-l/--level] [-o/--output <out-file>] <file>");
|
||||
println!(" uw8 run [-t/--timeout <frames>] [-w/--watch] [-p/--pack] [-u/--uncompressed] [-l/--level] [-o/--output <out-file>] <file>");
|
||||
println!(" uw8 pack [-u/--uncompressed] [-l/--level] <in-file> <out-file>");
|
||||
println!(" uw8 filter-exports <in-wasm> <out-wasm>");
|
||||
Ok(())
|
||||
@@ -42,6 +42,7 @@ fn main() -> Result<()> {
|
||||
|
||||
fn run(mut args: Arguments) -> Result<()> {
|
||||
let watch_mode = args.contains(["-w", "--watch"]);
|
||||
let timeout: Option<u32> = args.opt_value_from_str(["-t", "--timeout"])?;
|
||||
|
||||
let mut config = Config::default();
|
||||
if args.contains(["-p", "--pack"]) {
|
||||
@@ -67,6 +68,10 @@ fn run(mut args: Arguments) -> Result<()> {
|
||||
|
||||
let mut uw8 = MicroW8::new()?;
|
||||
|
||||
if let Some(timeout) = timeout {
|
||||
uw8.set_timeout(timeout);
|
||||
}
|
||||
|
||||
let (tx, rx) = mpsc::channel();
|
||||
let mut watcher = notify::watcher(tx, Duration::from_millis(100))?;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user