1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 03:27:44 +00:00

timeout: fix subprocess is never terminated

This commit is contained in:
Miles Liu 2023-02-01 15:39:07 +08:00
parent cf68665669
commit f406b56f4a
No known key found for this signature in database
GPG key ID: 4DB9B32F9B24A7A9
3 changed files with 55 additions and 9 deletions

View file

@ -138,3 +138,19 @@ fn test_kill_after_long() {
.no_stdout()
.no_stderr();
}
#[test]
fn test_kill_subprocess() {
new_ucmd!()
.args(&[
// Make sure the CI can spawn the subprocess.
"10",
"sh",
"-c",
"sh -c \"trap 'echo xyz' TERM; sleep 30\"",
])
.fails()
.code_is(124)
.stdout_contains("xyz")
.stderr_contains("Terminated");
}