fix that processes weren't started until priors finished
This commit is contained in:
10
src/main.rs
10
src/main.rs
@@ -38,7 +38,7 @@ enum MyError {
|
||||
}
|
||||
|
||||
async fn start(paths: &[impl AsRef<Path>]) -> 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<Path>]) -> 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<Path>]) -> Result<(), MyError> {
|
||||
}
|
||||
|
||||
async fn stop(paths: &[impl AsRef<Path>]) -> 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??;
|
||||
|
Reference in New Issue
Block a user