mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-05-07 12:40:04 +00:00
Simplify helpers::await_task
API
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
parent
072253ebae
commit
b223990bb1
2 changed files with 8 additions and 6 deletions
|
@ -39,9 +39,11 @@ pub use tls_version::TLSVersion;
|
|||
mod crate_name;
|
||||
pub use crate_name::CrateName;
|
||||
|
||||
pub async fn await_task<T>(task: tokio::task::JoinHandle<T>) -> miette::Result<T> {
|
||||
task.await
|
||||
.map_err(|join_err| miette::miette!("Task failed to join: {}", join_err))
|
||||
pub async fn await_task<T>(task: tokio::task::JoinHandle<miette::Result<T>>) -> miette::Result<T> {
|
||||
match task.await {
|
||||
Ok(res) => res,
|
||||
Err(join_err) => Err(miette::miette!("Task failed to join: {}", join_err)),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn create_jobserver_client() -> Result<jobserver::Client, BinstallError> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue