extern crate likemod;
extern crate tokio;
use std::{num, process, time};
use tokio::runtime::current_thread;
use tokio::timer::timeout;
fn main() {
let modname = std::env::args().nth(1).expect("missing module name");
let pause_ms = num::NonZeroU64::new(500).unwrap();
let modunload = likemod::ModUnloader::new().unload_async(&modname, pause_ms);
let tout = time::Duration::from_secs(15);
let fut = timeout::Timeout::new(modunload, tout);
if let Err(err) = current_thread::block_on_all(fut) {
eprintln!("FAILED: {:?}", err);
process::exit(1)
}
println!("module '{}' unloaded.", modname);
}