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