1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-29 03:57:44 +00:00

tee: return UResult from uumain() function

This commit is contained in:
Jeffrey Finkelstein 2021-12-31 14:07:39 -05:00
parent cb051e7416
commit 28958a3ed2

View file

@ -14,6 +14,7 @@ use std::fs::OpenOptions;
use std::io::{copy, sink, stdin, stdout, Error, ErrorKind, Read, Result, Write};
use std::path::PathBuf;
use uucore::display::Quotable;
use uucore::error::UResult;
#[cfg(unix)]
use uucore::libc;
@ -37,7 +38,8 @@ fn usage() -> String {
format!("{0} [OPTION]... [FILE]...", uucore::execution_phrase())
}
pub fn uumain(args: impl uucore::Args) -> i32 {
#[uucore_procs::gen_uumain]
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
let usage = usage();
let matches = uu_app().usage(&usage[..]).get_matches_from(args);
@ -52,8 +54,8 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
};
match tee(options) {
Ok(_) => 0,
Err(_) => 1,
Ok(_) => Ok(()),
Err(_) => Err(1.into()),
}
}