From 3c271304f5496b75e6f8f287934bf2d47a3c071f Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Wed, 16 Jun 2021 16:54:28 +0200 Subject: [PATCH] tty: correct exit code for wrong args --- src/uu/tty/src/tty.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/uu/tty/src/tty.rs b/src/uu/tty/src/tty.rs index edcdf091e..331f5e254 100644 --- a/src/uu/tty/src/tty.rs +++ b/src/uu/tty/src/tty.rs @@ -44,7 +44,15 @@ pub fn uumain(args: impl uucore::Args) -> i32 { .help("print nothing, only return an exit status") .required(false), ) - .get_matches_from(args); + .get_matches_from_safe(args); + + let matches = match matches { + Ok(m) => m, + Err(e) => { + eprint!("{}", e); + return 2; + } + }; let silent = matches.is_present(options::SILENT);