MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / reset_transient_tty_signals

Function reset_transient_tty_signals

crates/openshell-cli/src/ssh.rs:211–225  ·  view source on GitHub ↗
(command: &mut Command)

Source from the content-addressed store, hash-verified

209#[cfg(unix)]
210#[allow(unsafe_code)]
211fn reset_transient_tty_signals(command: &mut Command) {
212 // SAFETY: `pre_exec` runs in the forked child immediately before `exec`.
213 // We only reset a small fixed set of signal handlers to `SIG_DFL`, which is
214 // required so SSH receives terminal signals normally even though the parent
215 // process temporarily ignores them to preserve cleanup.
216 unsafe {
217 command.pre_exec(|| {
218 for &signal in TRANSIENT_TTY_SIGNALS {
219 let action = SigAction::new(SigHandler::SigDfl, SaFlags::empty(), SigSet::empty());
220 sigaction(signal, &action).map_err(|err| std::io::Error::other(err.to_string()))?;
221 }
222 Ok(())
223 });
224 }
225}
226
227fn exec_or_wait(mut command: Command, replace_process: bool) -> Result<()> {
228 if replace_process && std::io::stdin().is_terminal() {

Callers 1

exec_or_waitFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected