Skip to content

Commit

Permalink
helix-term: properly handle libc::kill's failure
Browse files Browse the repository at this point in the history
I misread the manpage for POSIX `kill` -- it returns `-1` in
the failure case, and sets `errno`, which is retrieved via
`std::io::Error::last_os_error()`, has its string representation printed
out, and then exits with the matching status code (or 1 if, for whatever
reason, there is no matching status code).
  • Loading branch information
cole-h committed Mar 9, 2023
1 parent f5b9362 commit 21ec516
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion helix-term/src/application.rs
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,9 @@ impl Application {
};

if res != 0 {
eprintln!("{}", std::io::Error::from_raw_os_error(res));
let err = std::io::Error::last_os_error();
eprintln!("{}", err);
let res = err.raw_os_error().unwrap_or(1);
std::process::exit(res);
}
}
Expand Down

0 comments on commit 21ec516

Please sign in to comment.