Skip to content

Commit 77549d7

Browse files
authored
Catch panics in child threads (#635)
1 parent b8272ae commit 77549d7

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/main.rs

+8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
use av1an_cli::run;
2+
use std::panic;
3+
use std::process;
24

35
fn main() -> anyhow::Result<()> {
6+
let orig_hook = panic::take_hook();
7+
// Catch panics in child threads
8+
panic::set_hook(Box::new(move |panic_info| {
9+
orig_hook(panic_info);
10+
process::exit(1);
11+
}));
412
run()
513
}

0 commit comments

Comments
 (0)