Skip to content

Commit

Permalink
kak_check_and with Result as param
Browse files Browse the repository at this point in the history
  • Loading branch information
vbauerster committed Nov 1, 2024
1 parent 419f52a commit a751025
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/kamp/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,18 +178,18 @@ impl Context {
let out_h = self.read_fifo_out(tx);

let kak_h = thread::spawn(move || kak::connect(self.session, cmd));
let kak_check = || {
let kak_check_and = |res| {
kak_h
.join()
.unwrap()
.map_err(|err| err.into())
.and_then(|status| self.check_status(status))
.and(res)
};

let res = match rx.recv().map_err(anyhow::Error::new) {
Err(e) => {
kak_check()?;
return Err(e.into());
return kak_check_and(Err(e.into()));
}
Ok(res) => res,
};
Expand All @@ -202,8 +202,7 @@ impl Context {
out_h.join().unwrap()?;
}
err_h.join().unwrap()?;
kak_check()?;
res.map(drop)
kak_check_and(res.map(drop))
}

pub fn query_val(
Expand Down

0 comments on commit a751025

Please sign in to comment.