1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-27 19:17:43 +00:00

Merge pull request #8197 from Luv-Ray/timeout_catch_sigterm

timeout: catch TERM signal
This commit is contained in:
Daniel Hofstetter 2025-07-05 17:19:40 +02:00 committed by GitHub
commit f74cceabc7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 65 additions and 7 deletions

View file

@ -204,3 +204,23 @@ fn test_hex_timeout_ending_with_d() {
.fails_with_code(124)
.no_output();
}
#[test]
fn test_terminate_child_on_receiving_terminate() {
let mut timeout_cmd = new_ucmd!()
.args(&[
"10",
"sh",
"-c",
"trap 'echo child received TERM' TERM; sleep 5",
])
.run_no_wait();
timeout_cmd.delay(100);
timeout_cmd.kill_with_custom_signal(nix::sys::signal::Signal::SIGTERM);
timeout_cmd
.make_assertion()
.is_not_alive()
.with_current_output()
.code_is(143)
.stdout_contains("child received TERM");
}