diff --git a/src/uucore/src/lib/features/process/unix.rs b/src/uucore/src/lib/features/process/unix.rs index c2e2dde9f03..da433fb60ae 100644 --- a/src/uucore/src/lib/features/process/unix.rs +++ b/src/uucore/src/lib/features/process/unix.rs @@ -5,6 +5,7 @@ // spell-checker:ignore sigwait KTIME timeval itimerval setitimer itimer timerid // spell-checker:ignore sigevent sigev sigval itimerspec signo clockid sevp +// spell-checker:ignore SIGXCPU SIGXFSZ SIGVTALRM SIGPROF #[cfg(not(any(target_os = "fuchsia", target_os = "haiku")))] use libc::pid_t; @@ -84,6 +85,7 @@ impl ChildExt for Child { } // otherwise waits again } Ok(Some(Signal::SIGTERM)) if ignore_term => {} // waits again + Ok(Some(Signal::SIGTTIN | Signal::SIGTTOU | Signal::SIGTSTP)) => {} // waits again Ok(Some(signal)) => break Ok(TimeoutRet::Interrupted(signal as usize)), Err(e) => break Err(e), } @@ -107,6 +109,13 @@ pub fn timeout_signal_set() -> SigSet { set.add(Signal::SIGUSR1); set.add(Signal::SIGUSR2); set.add(Signal::SIGCHLD); + set.add(Signal::SIGTTIN); + set.add(Signal::SIGTTOU); + set.add(Signal::SIGTSTP); + set.add(Signal::SIGXCPU); + set.add(Signal::SIGXFSZ); + set.add(Signal::SIGVTALRM); + set.add(Signal::SIGPROF); set } diff --git a/tests/by-util/test_timeout.rs b/tests/by-util/test_timeout.rs index 3d09a6e21ac..41e0acec715 100644 --- a/tests/by-util/test_timeout.rs +++ b/tests/by-util/test_timeout.rs @@ -3,7 +3,7 @@ // For the full copyright and license information, please view the LICENSE // file that was distributed with this source code. -// spell-checker:ignore dont SIGBREAK +// spell-checker:ignore dont SIGBREAK SIGTTIN ttin use rstest::rstest; use std::time::Duration; @@ -555,3 +555,15 @@ fn test_windows_command_cannot_invoke() { .args(&["1", ".\\not_executable.txt"]) .fails_with_code(126); } + +#[test] +#[cfg(unix)] +fn test_continue_terminal_job_ctrl_sigs() { + let name = util_name!(); + let (ts, bin) = scenario_with_bin(); + ts.cmd("/bin/sh") + .arg("-c") + .arg(format!("trap 'echo' SIGTTIN; {bin:?} {name} 2 /bin/cat")) + .timeout(Duration::from_secs(4)) + .succeeds(); +}