Clean shutdown for subcommands
@@ -96,7 +96,7 @@ pub fn build_runtime() -> std::result::Result<tokio::runtime::Runtime, std::io::
fn run_until_exit<FUT, ERR>(
mut tokio_runtime: tokio::runtime::Runtime,
future: FUT,
- mut task_manager: TaskManager,
+ task_manager: TaskManager,
) -> Result<()>
where
FUT: Future<Output = std::result::Result<(), ERR>> + future::Future,
@@ -106,9 +106,7 @@ where
pin_mut!(f);
tokio_runtime.block_on(main(f)).map_err(|e| e.to_string())?;
-
- task_manager.terminate();
- drop(tokio_runtime);
+ tokio_runtime.block_on(task_manager.clean_shutdown());
Ok(())
}
