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
8 changes: 8 additions & 0 deletions src/uucore/src/lib/features/process/unix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
// spell-checker:ignore pgrep pwait snice getpgrp
// 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

use libc::{gid_t, pid_t, uid_t};
#[cfg(not(target_os = "redox"))]
Expand Down Expand Up @@ -137,6 +138,7 @@ impl ChildExt for Child {
} // otherwise waits again
}
Ok(Some(Signal::SIGTERM)) if ignore_term => {} // waits again
Ok(Some(Signal::SIGTTIN | Signal::SIGTTOU)) => {} // waits again
Ok(Some(signal)) => break Ok(TimeoutRet::Interrupted(signal as usize)),
Err(e) => break Err(e),
}
Expand All @@ -158,6 +160,12 @@ 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::SIGXCPU);
set.add(Signal::SIGXFSZ);
set.add(Signal::SIGVTALRM);
set.add(Signal::SIGPROF);
set
}

Expand Down
12 changes: 11 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 @@ -443,3 +443,13 @@ 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 (ts, bin) = scenario_with_bin();
ts.cmd("/bin/sh")
.arg("-c")
.arg(format!("trap 'echo' SIGTTIN; {bin:?} 2 /bin/cat"))
.timeout(Duration::from_secs(4));
}
Loading