diff --git a/src/uu/tty/src/tty.rs b/src/uu/tty/src/tty.rs index b13b61784..4ae5ad007 100644 --- a/src/uu/tty/src/tty.rs +++ b/src/uu/tty/src/tty.rs @@ -12,7 +12,7 @@ use clap::{crate_version, Arg, Command}; use std::ffi::CStr; use std::io::Write; -use uucore::error::{UResult, UUsageError}; +use uucore::error::UResult; use uucore::{format_usage, InvalidEncodingHandling}; static ABOUT: &str = "Print the file name of the terminal connected to standard input."; @@ -28,9 +28,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> { .collect_str(InvalidEncodingHandling::ConvertLossy) .accept_any(); - let matches = uu_app() - .try_get_matches_from(args) - .map_err(|e| UUsageError::new(2, format!("{}", e)))?; + let matches = uu_app().get_matches_from(args); let silent = matches.is_present(options::SILENT); diff --git a/tests/by-util/test_tty.rs b/tests/by-util/test_tty.rs index ed490e7ab..09340d39c 100644 --- a/tests/by-util/test_tty.rs +++ b/tests/by-util/test_tty.rs @@ -64,6 +64,11 @@ fn test_wrong_argument() { new_ucmd!().args(&["a"]).fails().code_is(2); } +#[test] +fn test_help() { + new_ucmd!().args(&["--help"]).succeeds(); +} + #[test] // FixME: freebsd panic #[cfg(all(unix, not(target_os = "freebsd")))]