1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2026-01-15 09:41:07 +00:00

Merge pull request #2797 from jfinkels/factor-uresult

factor: return UResult from uumain() function
This commit is contained in:
Terts Diepraam 2021-12-29 15:02:22 +01:00 committed by GitHub
commit 2fa0c55a6e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -17,6 +17,7 @@ mod factor;
use clap::{crate_version, App, Arg};
pub use factor::*;
use uucore::display::Quotable;
use uucore::error::UResult;
mod miller_rabin;
pub mod numeric;
@ -43,7 +44,8 @@ fn print_factors_str(
})
}
pub fn uumain(args: impl uucore::Args) -> i32 {
#[uucore_procs::gen_uumain]
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
let matches = uu_app().get_matches_from(args);
let stdout = stdout();
// We use a smaller buffer here to pass a gnu test. 4KiB appears to be the default pipe size for bash.
@ -72,7 +74,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
show_error!("{}", e);
}
0
Ok(())
}
pub fn uu_app() -> App<'static, 'static> {