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

Merge pull request #7069 from samueltardieu/push-zrokzuowvlkv

kill: add `-n` hidden option for compatibility with bash
This commit is contained in:
Daniel Hofstetter 2025-01-04 14:47:42 +01:00 committed by GitHub
commit e0031565ba
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 12 additions and 0 deletions

View file

@ -122,6 +122,7 @@ pub fn uu_app() -> Command {
.arg( .arg(
Arg::new(options::SIGNAL) Arg::new(options::SIGNAL)
.short('s') .short('s')
.short_alias('n') // For bash compatibility, like in GNU coreutils
.long(options::SIGNAL) .long(options::SIGNAL)
.value_name("signal") .value_name("signal")
.help("Sends given signal instead of SIGTERM"), .help("Sends given signal instead of SIGTERM"),

View file

@ -296,3 +296,14 @@ fn test_kill_with_signal_exit_new_form() {
.arg(format!("{}", target.pid())) .arg(format!("{}", target.pid()))
.succeeds(); .succeeds();
} }
#[test]
fn test_kill_with_signal_number_hidden_compatibility_option() {
let mut target = Target::new();
new_ucmd!()
.arg("-n")
.arg("9")
.arg(format!("{}", target.pid()))
.succeeds();
assert_eq!(target.wait_for_signal(), Some(9));
}