Skip to content

Commit

Permalink
join kak_h in the closure
Browse files Browse the repository at this point in the history
  • Loading branch information
vbauerster committed Oct 31, 2024
1 parent 5fb629f commit c12634f
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/kamp/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,11 +177,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 = || {
kak_h
.join()
.unwrap()
.map_err(|err| err.into())
.and_then(|status| self.check_status(status))
};

let res = match rx.recv().map_err(anyhow::Error::new) {
Err(e) => {
let status = kak_h.join().unwrap()?;
return self.check_status(status).and_then(|_| Err(e.into()));
kak_check()?;
return Err(e.into());
}
Ok(res) => res,
};
Expand All @@ -194,7 +201,7 @@ impl Context {
out_h.join().unwrap()?;
}
err_h.join().unwrap()?;
kak_h.join().unwrap()?;
kak_check()?;
res.map(drop)
}

Expand Down

0 comments on commit c12634f

Please sign in to comment.