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:
commit
f74cceabc7
4 changed files with 65 additions and 7 deletions
|
@ -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");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue