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

kill: don't allow lowercase signal names with '-'

This commit is contained in:
Daniel Hofstetter 2025-01-24 16:29:36 +01:00
parent 943b44627b
commit 2668c98d9d
2 changed files with 20 additions and 4 deletions

View file

@ -198,12 +198,24 @@ fn test_kill_with_signal_number_old_form() {
#[test]
fn test_kill_with_signal_name_old_form() {
let mut target = Target::new();
for arg in ["-Kill", "-KILL"] {
let mut target = Target::new();
new_ucmd!()
.arg(arg)
.arg(format!("{}", target.pid()))
.succeeds();
assert_eq!(target.wait_for_signal(), Some(libc::SIGKILL));
}
}
#[test]
fn test_kill_with_lower_case_signal_name_old_form() {
let target = Target::new();
new_ucmd!()
.arg("-KILL")
.arg("-kill")
.arg(format!("{}", target.pid()))
.succeeds();
assert_eq!(target.wait_for_signal(), Some(libc::SIGKILL));
.fails()
.stderr_contains("unexpected argument");
}
#[test]