mirror of
https://github.com/fish-shell/fish-shell
synced 2024-11-14 00:47:30 +00:00
Revert "Remove unsafe from exit_without_destructors()
"
This reverts commit f9c92753c4
.
This commit attempted to replace exit_without_destructors() with
std::process::exit; however this is wrong for two reasons:
1. std::process::exit() runs Rust runtime cleanup stuff we don't want
2. std::process::exit() invokes destructors, meaning atexit handlers,
which we don't want.
This commit is contained in:
parent
76dc849fca
commit
009650b7b5
1 changed files with 4 additions and 4 deletions
|
@ -956,11 +956,11 @@ pub const fn char_offset(base: char, offset: u32) -> char {
|
|||
}
|
||||
}
|
||||
|
||||
/// Exits without invoking destructors; useful for forked processes.
|
||||
///
|
||||
/// [`std::process::exit()`] is used; it exits immediately without running any destructors.
|
||||
/// Exits without invoking destructors (via _exit), useful for code after fork.
|
||||
fn exit_without_destructors(code: i32) -> ! {
|
||||
std::process::exit(code)
|
||||
unsafe {
|
||||
libc::_exit(code);
|
||||
}
|
||||
}
|
||||
|
||||
/// Save the shell mode on startup so we can restore them on exit.
|
||||
|
|
Loading…
Reference in a new issue