mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-04-22 13:38:43 +00:00
Detect install_path & load metadata in block_in_place
since they involves blocking fs io. Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
parent
b4c6db7cda
commit
b8c44839c1
1 changed files with 18 additions and 14 deletions
|
@ -322,6 +322,7 @@ async fn entry(jobserver_client: LazyJobserverClient) -> Result<()> {
|
||||||
let mut uithread = UIThread::new(!opts.no_confirm);
|
let mut uithread = UIThread::new(!opts.no_confirm);
|
||||||
|
|
||||||
// Compute install directory
|
// Compute install directory
|
||||||
|
let (install_path, metadata) = block_in_place(|| -> Result<_> {
|
||||||
let (install_path, custom_install_path) = get_install_path(opts.install_path.as_deref());
|
let (install_path, custom_install_path) = get_install_path(opts.install_path.as_deref());
|
||||||
let install_path = install_path.ok_or_else(|| {
|
let install_path = install_path.ok_or_else(|| {
|
||||||
error!("No viable install path found of specified, try `--install-path`");
|
error!("No viable install path found of specified, try `--install-path`");
|
||||||
|
@ -333,11 +334,14 @@ async fn entry(jobserver_client: LazyJobserverClient) -> Result<()> {
|
||||||
// Load metadata
|
// Load metadata
|
||||||
let metadata = if !custom_install_path {
|
let metadata = if !custom_install_path {
|
||||||
debug!("Reading binstall/crates-v1.json");
|
debug!("Reading binstall/crates-v1.json");
|
||||||
Some(block_in_place(metafiles::binstall_v1::Records::load)?)
|
Some(metafiles::binstall_v1::Records::load()?)
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Ok((install_path, metadata))
|
||||||
|
})?;
|
||||||
|
|
||||||
// Remove installed crates
|
// Remove installed crates
|
||||||
let crate_names = CrateName::dedup(crate_names).filter(|crate_name| {
|
let crate_names = CrateName::dedup(crate_names).filter(|crate_name| {
|
||||||
if opts.force {
|
if opts.force {
|
||||||
|
|
Loading…
Add table
Reference in a new issue