From a13180f79a8cb2c6d011145bbd76eb27b31e728f Mon Sep 17 00:00:00 2001 From: Jiahao XU Date: Thu, 4 Aug 2022 18:37:52 +1000 Subject: [PATCH] Ret `BinstallError` in `::poll` Signed-off-by: Jiahao XU --- src/helpers/auto_abort_join_handle.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/helpers/auto_abort_join_handle.rs b/src/helpers/auto_abort_join_handle.rs index 8faa1f25..669f352a 100644 --- a/src/helpers/auto_abort_join_handle.rs +++ b/src/helpers/auto_abort_join_handle.rs @@ -5,7 +5,9 @@ use std::{ task::{Context, Poll}, }; -use tokio::task::{JoinError, JoinHandle}; +use tokio::task::JoinHandle; + +use super::BinstallError; #[derive(Debug)] pub struct AutoAbortJoinHandle(JoinHandle); @@ -49,9 +51,11 @@ impl DerefMut for AutoAbortJoinHandle { } impl Future for AutoAbortJoinHandle { - type Output = Result; + type Output = Result; fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { - Pin::new(&mut Pin::into_inner(self).0).poll(cx) + Pin::new(&mut Pin::into_inner(self).0) + .poll(cx) + .map(|res| res.map_err(BinstallError::TaskJoinError)) } }