mirror of
https://github.com/uutils/coreutils
synced 2024-07-23 19:04:18 +00:00
pr: return correct exit code on error
This commit is contained in:
parent
f5f8cf08e0
commit
9527341714
|
@ -386,13 +386,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
|||
let opt_args = recreate_arguments(&args);
|
||||
|
||||
let mut command = uu_app();
|
||||
let matches = match command.try_get_matches_from_mut(opt_args) {
|
||||
Ok(m) => m,
|
||||
Err(e) => {
|
||||
e.print()?;
|
||||
return Ok(());
|
||||
}
|
||||
};
|
||||
let matches = command.try_get_matches_from_mut(opt_args)?;
|
||||
|
||||
let mut files = matches
|
||||
.get_many::<String>(options::FILES)
|
||||
|
|
|
@ -43,6 +43,15 @@ fn valid_last_modified_template_vars(from: DateTime<Utc>) -> Vec<Vec<(String, St
|
|||
.collect()
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_invalid_flag() {
|
||||
new_ucmd!()
|
||||
.arg("--invalid-argument")
|
||||
.fails()
|
||||
.no_stdout()
|
||||
.code_is(1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_without_any_options() {
|
||||
let test_file_path = "test_one_page.log";
|
||||
|
|
Loading…
Reference in a new issue