mirror of
https://github.com/uutils/coreutils
synced 2024-11-17 02:08:09 +00:00
Merge pull request #2830 from jfinkels/tee-uresult
tee: return UResult from uumain() function
This commit is contained in:
commit
8ef2ea1356
1 changed files with 5 additions and 3 deletions
|
@ -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()),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue