mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-04-20 20:48:43 +00:00
Use get_desired_targets
in entry
instead of `detect_targets`, so that if `opts.targets` is `None`, the future returned by `detect_targets` can be run in parallel by using `tokio::spawn` with other async code in `entry`, such as `fetch_crate_cratesio`. Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
parent
be4b3ead97
commit
68d111f946
1 changed files with 5 additions and 14 deletions
19
src/main.rs
19
src/main.rs
|
@ -193,6 +193,8 @@ async fn entry() -> Result<()> {
|
|||
|
||||
let mut uithread = UIThread::new(!opts.no_confirm);
|
||||
|
||||
let desired_targets = get_desired_targets(&opts.targets);
|
||||
|
||||
// Compute install directory
|
||||
let install_path = get_install_path(opts.install_path.as_deref()).ok_or_else(|| {
|
||||
error!("No viable install path found of specified, try `--install-path`");
|
||||
|
@ -242,22 +244,11 @@ async fn entry() -> Result<()> {
|
|||
manifest.bin,
|
||||
);
|
||||
|
||||
let desired_targets = {
|
||||
let from_opts = opts
|
||||
.targets
|
||||
.as_ref()
|
||||
.map(|ts| ts.split(',').map(|t| t.to_string()).collect());
|
||||
|
||||
if let Some(ts) = from_opts {
|
||||
ts
|
||||
} else {
|
||||
detect_targets().await
|
||||
}
|
||||
};
|
||||
|
||||
let mut fetchers = MultiFetcher::default();
|
||||
|
||||
for target in &desired_targets {
|
||||
let desired_targets = desired_targets.get().await;
|
||||
|
||||
for target in desired_targets {
|
||||
debug!("Building metadata for target: {target}");
|
||||
let mut target_meta = meta.clone();
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue