1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-09-15 19:36:16 +00:00

Merge pull request #4315 from miles170/issue-4176-fix-timeout

timeout: fix subprocess is never terminated
This commit is contained in:
Terts Diepraam 2023-03-15 14:10:58 +01:00 committed by GitHub
commit dad474bfa0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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");
}