process_wrap/std/
reset_sigmask.rs1use std::{io::Result, os::unix::process::CommandExt, process::Command};
2
3use nix::sys::signal::{SigSet, SigmaskHow, sigprocmask};
4
5use super::{CommandWrap, CommandWrapper};
6
7#[derive(Clone, Copy, Debug)]
12pub struct ResetSigmask;
13
14impl CommandWrapper for ResetSigmask {
15 fn pre_spawn(&mut self, command: &mut Command, _core: &CommandWrap) -> Result<()> {
16 unsafe {
17 command.pre_exec(|| {
18 let newset = SigSet::all();
19 sigprocmask(SigmaskHow::SIG_UNBLOCK, Some(&newset), None)?;
20 Ok(())
21 });
22 }
23 Ok(())
24 }
25}