summaryrefslogtreecommitdiffstats
path: root/tokio/src/fs/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tokio/src/fs/mod.rs')
-rw-r--r--tokio/src/fs/mod.rs12
1 files changed, 10 insertions, 2 deletions
diff --git a/tokio/src/fs/mod.rs b/tokio/src/fs/mod.rs
index ed3b4162..9108116a 100644
--- a/tokio/src/fs/mod.rs
+++ b/tokio/src/fs/mod.rs
@@ -84,12 +84,20 @@ where
F: FnOnce() -> io::Result<T> + Send + 'static,
T: Send + 'static,
{
- sys::run(f).await
+ match sys::run(f).await {
+ Ok(res) => res,
+ Err(_) => Err(io::Error::new(
+ io::ErrorKind::Other,
+ "background task failed",
+ )),
+ }
}
/// Types in this module can be mocked out in tests.
mod sys {
pub(crate) use std::fs::File;
- pub(crate) use crate::runtime::blocking::{run, Blocking};
+ // TODO: don't rename
+ pub(crate) use crate::blocking::spawn_blocking as run;
+ pub(crate) use crate::task::JoinHandle as Blocking;
}