Use `unsafe` only where necessary
@@ -768,21 +768,16 @@ impl VirtualMachine {
self.print_exception(exc);
#[cfg(unix)]
{
- unsafe {
- if sigaction(
- SIGINT,
- &SigAction::new(
+ let action = SigAction::new(
nix::sys::signal::SigHandler::SigDfl,
SaFlags::SA_ONSTACK,
SigSet::empty(),
- ),
- )
- .is_ok()
- {
+ );
+ let result = unsafe { sigaction(SIGINT, &action) };
+ if result.is_ok() {
interpreter::flush_std(self);
kill(getpid(), SIGINT).expect("Expect to be killed.");
}
- }
(libc::SIGINT as u8) + 128u8
}
