mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-27 11:07:44 +00:00
Merge pull request #3367 from sylvestre/tty
tty: should not return 2 when --help is used
This commit is contained in:
commit
5fbef7743b
2 changed files with 7 additions and 4 deletions
|
@ -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);
|
||||
|
||||
|
|
|
@ -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")))]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue