Skip to content

Commit

Permalink
minor: map and inspect exit_status
Browse files Browse the repository at this point in the history
  • Loading branch information
vbauerster committed Dec 4, 2024
1 parent 16a5790 commit ef930b7
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/kamp/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,13 @@ impl Context {

pub fn send_kill(self, exit_status: Option<i32>) -> Result<()> {
let mut cmd = String::from("kill");
if let Some(status) = exit_status {
cmd.push(' ');
cmd.push_str(&status.to_string());
}

exit_status
.map(|status| status.to_string())
.inspect(|status| {
cmd.push(' ');
cmd.push_str(status);
});

kak::pipe(self.session, cmd)
.map_err(From::from)
Expand Down

0 comments on commit ef930b7

Please sign in to comment.