1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-09-15 03:26:18 +00:00

Merge pull request #6061 from cre4ture/fix/flaky_timeout_kill_subprocess

Fix/flaky timeout kill subprocess
This commit is contained in:
Sylvestre Ledru 2024-03-13 11:13:09 +01:00 committed by GitHub
commit f89cfe2a5e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 31 additions and 11 deletions

View file

@ -93,6 +93,18 @@ fn test_preserve_status() {
.no_stdout();
}
#[test]
fn test_preserve_status_even_when_send_signal() {
// When sending CONT signal, process doesn't get killed or stopped.
// So, expected result is success and code 0.
new_ucmd!()
.args(&["-s", "CONT", "--preserve-status", ".1", "sleep", "5"])
.succeeds()
.code_is(0)
.no_stderr()
.no_stdout();
}
#[test]
fn test_dont_overflow() {
new_ucmd!()
@ -151,10 +163,10 @@ fn test_kill_subprocess() {
"10",
"sh",
"-c",
"sh -c \"trap 'echo xyz' TERM; sleep 30\"",
"trap 'echo inside_trap' TERM; sleep 30",
])
.fails()
.code_is(124)
.stdout_contains("xyz")
.stdout_contains("inside_trap")
.stderr_contains("Terminated");
}