fix exit code when error occcurs (#1173)

This commit is contained in:
Sijie.Sun
2025-07-30 23:05:22 +08:00
committed by GitHub
parent b1b2421561
commit 583c768f40
2 changed files with 20 additions and 11 deletions

View File

@@ -1111,6 +1111,14 @@ async fn run_main(cli: Cli) -> anyhow::Result<()> {
tokio::select! {
_ = manager.wait() => {
let infos = manager.collect_network_infos()?;
let errs = infos
.into_values()
.filter_map(|info| info.error_msg)
.collect::<Vec<_>>();
if errs.len() > 0 {
return Err(anyhow::anyhow!("some instances stopped with errors"));
}
}
_ = tokio::signal::ctrl_c() => {
println!("ctrl-c received, exiting...");