From c504f47e27a193baa33de9c5f64ebddb1614719f Mon Sep 17 00:00:00 2001 From: Jacob Date: Thu, 4 Jul 2024 01:41:45 -0400 Subject: [PATCH] fix that processes weren't started until priors finished --- src/main.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main.rs b/src/main.rs index 46774ab..320fd2e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -38,7 +38,7 @@ enum MyError { } async fn start(paths: &[impl AsRef]) -> Result<(), MyError> { - let handles_and_paths = paths + let handles_and_paths: Vec<_> = paths .into_iter() .map(|path| { let mut command = tokio::process::Command::new("docker"); @@ -49,7 +49,8 @@ async fn start(paths: &[impl AsRef]) -> Result<(), MyError> { .current_dir(path); (path, command) }) - .map(|(path, mut command)| (path, tokio::spawn(command.output()))); + .map(|(path, mut command)| (path, tokio::spawn(command.output()))) + .collect(); for (path, handle) in handles_and_paths { let output = handle.await??; @@ -66,14 +67,15 @@ async fn start(paths: &[impl AsRef]) -> Result<(), MyError> { } async fn stop(paths: &[impl AsRef]) -> Result<(), MyError> { - let handles_and_paths = paths + let handles_and_paths: Vec<_> = paths .into_iter() .map(|path| { let mut command = tokio::process::Command::new("docker"); command.arg("compose").arg("down").current_dir(path); (path, command) }) - .map(|(path, mut command)| (path, tokio::spawn(command.output()))); + .map(|(path, mut command)| (path, tokio::spawn(command.output()))) + .collect(); for (path, handle) in handles_and_paths { let output = handle.await??;