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).
This commit is contained in:
Mahmoud Al-Qudsi 2023-04-23 13:05:56 -05:00
parent 20b500dce8
commit f9c92753c4

View File

@ -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) -> ! { fn exit_without_destructors(code: i32) -> ! {
unsafe { std::process::exit(code)
libc::_exit(code);
}
} }
/// Save the shell mode on startup so we can restore them on exit. /// Save the shell mode on startup so we can restore them on exit.