summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2021-04-23 09:13:48 +0300
committerLars Wirzenius <liw@liw.fi>2021-04-23 09:13:48 +0300
commit4b5b636bf056919f59cc1392b75c5b6dff7bc3f2 (patch)
treedb8d71b020fb5fd699dddab8885a97ddd2309478
parent1deab02129ee232aaa52ddccd11b413d390c5bb6 (diff)
downloadsummain-rs-4b5b636bf056919f59cc1392b75c5b6dff7bc3f2.tar.gz
spawn
-rw-r--r--src/bin/summain.rs9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/bin/summain.rs b/src/bin/summain.rs
index 69bfcdf..377a84d 100644
--- a/src/bin/summain.rs
+++ b/src/bin/summain.rs
@@ -9,13 +9,12 @@ async fn main() -> anyhow::Result<()> {
opt.pathnames[..].sort();
let mut handles = vec![];
- for filename in opt.pathnames.iter() {
- let h = report(&filename);
- handles.push(h);
+ for filename in opt.pathnames.iter().cloned() {
+ handles.push(tokio::spawn(async move { report(filename) }));
}
for h in handles {
- h.await?;
+ h.await?.await?;
}
Ok(())
@@ -27,7 +26,7 @@ struct Opt {
pathnames: Vec<PathBuf>,
}
-async fn report(path: &Path) -> anyhow::Result<()> {
+async fn report(path: PathBuf) -> anyhow::Result<()> {
let m = manifest(&path).await?;
print!("{}", serde_yaml::to_string(&m)?);
Ok(())