|
|
|
@ -32,7 +32,7 @@ where T: Future
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async fn do_work(process: impl AsRef<Path>, file: impl AsRef<OsStr>) -> Result<Vec<String>, process::Error>
|
|
|
|
|
async fn do_work(process: impl AsRef<Path>, file: impl AsRef<OsStr>) -> Result<fixed_stack::IntoIter<String>, process::Error>
|
|
|
|
|
{
|
|
|
|
|
let process = process.as_ref();
|
|
|
|
|
let file = file.as_ref();
|
|
|
|
@ -48,7 +48,7 @@ async fn do_work(process: impl AsRef<Path>, file: impl AsRef<OsStr>) -> Result<V
|
|
|
|
|
});
|
|
|
|
|
tokio::task::yield_now().await;
|
|
|
|
|
match process::contained_spawn(process, std::iter::once(file), tx).await {
|
|
|
|
|
Ok(_) => Ok(collector.await.expect("Child panic").into_iter().collect()),
|
|
|
|
|
Ok(_) => Ok(collector.await.expect("Child panic").into_iter()),
|
|
|
|
|
Err(error) => Err(error),
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -58,7 +58,7 @@ where I: IntoIterator<Item=T>,
|
|
|
|
|
T: AsRef<OsStr> + Send + Sync + 'static,
|
|
|
|
|
U: Into<PathBuf>
|
|
|
|
|
{
|
|
|
|
|
let (tx,mut rx) = mpsc::channel::<(T, Vec<String>)>(children.as_ref().map(|&x| usize::from(x)).unwrap_or(16));
|
|
|
|
|
let (tx,mut rx) = mpsc::channel::<(T, fixed_stack::IntoIter<String>)>(children.as_ref().map(|&x| usize::from(x)).unwrap_or(16));
|
|
|
|
|
let semaphore = children.map(|children| Arc::new(Semaphore::new(children.into())));
|
|
|
|
|
let process = Arc::new(process.into());
|
|
|
|
|
|
|
|
|
|