Commit 68d9e04d authored by Nawasan Wisitsingkhon's avatar Nawasan Wisitsingkhon

fix: run with cli doesn't wait

parent 38b947f3
...@@ -50,10 +50,11 @@ pub async fn system() { ...@@ -50,10 +50,11 @@ pub async fn system() {
port, port,
listen, listen,
} => { } => {
let mut thread_list = Vec::new();
for p in port.iter() { for p in port.iter() {
let addr = format!("{}:{}", listen, p); let addr = format!("{}:{}", listen, p);
let controller = controller.clone(); let controller = controller.clone();
tokio::spawn(async move { let t = tokio::spawn(async move {
match controller { match controller {
Some(controller) => match controller { Some(controller) => match controller {
Controllers::Ctrl13 => Controller13::new().listener(&addr).await, Controllers::Ctrl13 => Controller13::new().listener(&addr).await,
...@@ -63,6 +64,10 @@ pub async fn system() { ...@@ -63,6 +64,10 @@ pub async fn system() {
None => Controller13::new().listener(&addr).await, None => Controller13::new().listener(&addr).await,
} }
}); });
thread_list.push(t);
}
for th in thread_list {
let _ = th.await;
} }
} }
Commands::Generate { shell } => { Commands::Generate { shell } => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment