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.