From f9c92753c433ee15509643020129bd34c25f2242 Mon Sep 17 00:00:00 2001 From: Mahmoud Al-Qudsi Date: Sun, 23 Apr 2023 13:05:56 -0500 Subject: [PATCH] Remove unsafe from `exit_without_destructors()` std::process::exit() already does what we need and and it is safe to call (since it is not unsafe for destructors not to be called). --- fish-rust/src/common.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/fish-rust/src/common.rs b/fish-rust/src/common.rs index 7afcd4c9a..62743cd1b 100644 --- a/fish-rust/src/common.rs +++ b/fish-rust/src/common.rs @@ -965,11 +965,11 @@ pub const fn char_offset(base: char, offset: u32) -> char { } } -/// Exits without invoking destructors (via _exit), useful for code after fork. +/// Exits without invoking destructors; useful for forked processes. +/// +/// [`std::process::exit()`] is used; it exits immediately without running any destructors. fn exit_without_destructors(code: i32) -> ! { - unsafe { - libc::_exit(code); - } + std::process::exit(code) } /// Save the shell mode on startup so we can restore them on exit.