From 60caa9ee177574236b975767e767b7889e7da7d0 Mon Sep 17 00:00:00 2001 From: Jiahao XU Date: Thu, 23 Jun 2022 19:50:25 +1000 Subject: [PATCH] Run `load_manifest_path` in `block_in_place` mode Signed-off-by: Jiahao XU --- src/helpers.rs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/helpers.rs b/src/helpers.rs index 03bf97c9..55edc19a 100644 --- a/src/helpers.rs +++ b/src/helpers.rs @@ -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,13 +39,15 @@ pub static REQWESTGLOBALCONFIG: OnceCell<(bool, Option)> = OnceCell: pub fn load_manifest_path>( manifest_path: P, ) -> Result, BinstallError> { - debug!("Reading manifest: {}", manifest_path.as_ref().display()); + block_in_place(|| { + debug!("Reading manifest: {}", manifest_path.as_ref().display()); - // Load and parse manifest (this checks file system for binary output names) - let manifest = Manifest::::from_path_with_metadata(manifest_path)?; + // Load and parse manifest (this checks file system for binary output names) + let manifest = Manifest::::from_path_with_metadata(manifest_path)?; - // Return metadata - Ok(manifest) + // Return metadata + Ok(manifest) + }) } pub fn new_reqwest_client_builder() -> ClientBuilder {