Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/uucore/src/lib/features/process/unix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Comment thread
Alonely0 marked this conversation as resolved.
Ok(Some(signal)) => break Ok(TimeoutRet::Interrupted(signal as usize)),
Err(e) => break Err(e),
}
Expand All @@ -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
}

Expand Down
14 changes: 13 additions & 1 deletion tests/by-util/test_timeout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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"))
Comment thread
Alonely0 marked this conversation as resolved.
Comment on lines +564 to +566
.timeout(Duration::from_secs(4))
.succeeds();
}
Loading