mirror of
https://github.com/uutils/coreutils
synced 2024-12-13 14:52:41 +00:00
hostid: return correct exit code on error
This commit is contained in:
parent
333e4d9fe9
commit
f5f8cf08e0
2 changed files with 10 additions and 1 deletions
|
@ -19,7 +19,7 @@ extern "C" {
|
|||
|
||||
#[uucore::main]
|
||||
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
||||
uu_app().get_matches_from(args);
|
||||
uu_app().try_get_matches_from(args)?;
|
||||
hostid();
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
@ -10,3 +10,12 @@ fn test_normal() {
|
|||
let re = Regex::new(r"^[0-9a-f]{8}").unwrap();
|
||||
new_ucmd!().succeeds().stdout_matches(&re);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_invalid_flag() {
|
||||
new_ucmd!()
|
||||
.arg("--invalid-argument")
|
||||
.fails()
|
||||
.no_stdout()
|
||||
.code_is(1);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue