| 180 | impl ParentSignalGuard { |
| 181 | #[allow(unsafe_code)] |
| 182 | fn ignore_transient_tty_signals() -> Result<Self> { |
| 183 | let mut previous = Vec::with_capacity(TRANSIENT_TTY_SIGNALS.len()); |
| 184 | for &signal in TRANSIENT_TTY_SIGNALS { |
| 185 | let action = SigAction::new(SigHandler::SigIgn, SaFlags::empty(), SigSet::empty()); |
| 186 | // SAFETY: `sigaction` is the POSIX API for updating process signal |
| 187 | // dispositions. We install `SIG_IGN` for a small fixed set of |
| 188 | // terminal signals and store the previous handlers for restoration. |
| 189 | let old = unsafe { sigaction(signal, &action) }.into_diagnostic()?; |
| 190 | previous.push((signal, old)); |
| 191 | } |
| 192 | Ok(Self { previous }) |
| 193 | } |
| 194 | } |
| 195 | |
| 196 | #[cfg(unix)] |