Run load_manifest_path in block_in_place mode

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
Jiahao XU 2022-06-23 19:50:25 +10:00
parent a35db557ea
commit 60caa9ee17
No known key found for this signature in database
GPG key ID: 591C0B03040416D6

View file

@ -9,6 +9,7 @@ use once_cell::sync::OnceCell;
use reqwest::{Client, ClientBuilder, Method, Response};
use serde::Serialize;
use tinytemplate::TinyTemplate;
use tokio::task::block_in_place;
use url::Url;
use crate::{BinstallError, Meta, PkgFmt, PkgFmtDecomposed, TarBasedFmt};
@ -38,6 +39,7 @@ pub static REQWESTGLOBALCONFIG: OnceCell<(bool, Option<TLSVersion>)> = OnceCell:
pub fn load_manifest_path<P: AsRef<Path>>(
manifest_path: P,
) -> Result<Manifest<Meta>, BinstallError> {
block_in_place(|| {
debug!("Reading manifest: {}", manifest_path.as_ref().display());
// Load and parse manifest (this checks file system for binary output names)
@ -45,6 +47,7 @@ pub fn load_manifest_path<P: AsRef<Path>>(
// Return metadata
Ok(manifest)
})
}
pub fn new_reqwest_client_builder() -> ClientBuilder {