diff --git a/CHANGELOG.rst b/CHANGELOG.rst index fa91bd759..bebb5ba10 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,6 +1,7 @@ Changes since 4.0b1 ------------------- - :kbd:`ctrl-c` cancels builtin ``read`` again, fixing a regression in the beta. :issue:`10928` +- Fix a BSD-specific regression in the beta that caused crashes when a child process exited with a status like -1 (:issue:`10919`). - Fix a regression in the beta where ``__fish_cancel_commandline`` caused glitches on multi-line command lines (:issue:`10935`). - Self-installable builds can now also be installed to a specific location by giving a path to ``--install``, like:: fish --install=$HOME/.local/ diff --git a/src/proc.rs b/src/proc.rs index cc8012183..7537458fa 100644 --- a/src/proc.rs +++ b/src/proc.rs @@ -233,14 +233,14 @@ pub fn signal_code(&self) -> libc::c_int { } /// Return the exit code, given that we normal exited. - pub fn exit_code(&self) -> libc::c_int { + pub fn exit_code(&self) -> u8 { assert!(self.normal_exited(), "Process is not normal exited"); - WEXITSTATUS(self.status()) + u8::try_from(WEXITSTATUS(self.status()) & 0xff).unwrap() // Workaround for libc bug } /// Return if this status represents success. pub fn is_success(&self) -> bool { - self.normal_exited() && self.exit_code() == EXIT_SUCCESS + self.normal_exited() && self.exit_code() == u8::try_from(EXIT_SUCCESS).unwrap() } /// Return the value appropriate to populate $status. @@ -248,7 +248,7 @@ pub fn status_value(&self) -> i32 { if self.signal_exited() { 128 + self.signal_code() } else if self.normal_exited() { - self.exit_code() + i32::from(self.exit_code()) } else { panic!("Process is not exited") }