1
0
Fork 0
forked from wry/wry

runtime: ignore SIGPIPE

This commit is contained in:
Julian Orth 2022-05-12 14:17:10 +02:00
parent 285724b4f1
commit 57e8077942

View file

@ -23,6 +23,7 @@ pub fn install(el: &Rc<EventLoop>) -> Result<(), SighandError> {
let mut set: c::sigset_t = uapi::pod_zeroed();
uapi::sigaddset(&mut set, c::SIGINT).unwrap();
uapi::sigaddset(&mut set, c::SIGTERM).unwrap();
uapi::sigaddset(&mut set, c::SIGPIPE).unwrap();
if let Err(e) = uapi::pthread_sigmask(c::SIG_BLOCK, Some(&set), None) {
return Err(SighandError::BlockFailed(e.into()));
}
@ -59,9 +60,12 @@ impl EventLoopDispatcher for Sighand {
_ => return Err(Box::new(SighandError::ReadFailed(e.into()))),
}
}
log::info!("Received signal {}", sigfd.ssi_signo);
log::info!("Exiting");
self.el.stop();
let sig = sigfd.ssi_signo as i32;
log::info!("Received signal {}", sig);
if matches!(sig, c::SIGINT | c::SIGTERM) {
log::info!("Exiting");
self.el.stop();
}
}
Ok(())
}