aboutsummaryrefslogtreecommitdiffstats
path: root/src/state.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/state.rs')
-rw-r--r--src/state.rs23
1 files changed, 17 insertions, 6 deletions
diff --git a/src/state.rs b/src/state.rs
index b9707c0..f6c8a78 100644
--- a/src/state.rs
+++ b/src/state.rs
@@ -104,13 +104,8 @@ impl State {
eprint!("command exited: {}\r\n", status);
Ok(())
}
-}
-
-impl futures::future::Future for State {
- type Item = ();
- type Error = Error;
- fn poll(&mut self) -> futures::Poll<Self::Item, Self::Error> {
+ fn poll_with_errors(&mut self) -> futures::Poll<(), Error> {
loop {
let mut did_work = false;
@@ -175,6 +170,22 @@ impl futures::future::Future for State {
}
}
+impl futures::future::Future for State {
+ type Item = ();
+ type Error = ();
+
+ fn poll(&mut self) -> futures::Poll<Self::Item, Self::Error> {
+ loop {
+ match self.poll_with_errors() {
+ Ok(a) => return Ok(a),
+ Err(e) => {
+ eprint!("error polling state: {}\r\n", e);
+ }
+ }
+ }
+ }
+}
+
struct Command {
future: crate::eval::Eval,
res: futures::sync::oneshot::Sender<()>,