1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 11:37:44 +00:00

Merge pull request #7792 from karlmcdowall/tail_fix_v_option

tail: fix issue with -v flag and stdin
This commit is contained in:
Daniel Hofstetter 2025-04-20 17:00:37 +02:00 committed by GitHub
commit f92ee6a519
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 20 additions and 5 deletions

View file

@ -290,8 +290,9 @@ impl Settings {
.map(|v| v.map(Input::from).collect()) .map(|v| v.map(Input::from).collect())
.unwrap_or_else(|| vec![Input::default()]); .unwrap_or_else(|| vec![Input::default()]);
settings.verbose = settings.verbose = (matches.get_flag(options::verbosity::VERBOSE)
settings.inputs.len() > 1 && !matches.get_flag(options::verbosity::QUIET); || settings.inputs.len() > 1)
&& !matches.get_flag(options::verbosity::QUIET);
Ok(settings) Ok(settings)
} }

View file

@ -96,8 +96,6 @@ fn test_stdin_explicit() {
} }
#[test] #[test]
// FIXME: the -f test fails with: Assertion failed. Expected 'tail' to be running but exited with status=exit status: 0
#[ignore = "disabled until fixed"]
#[cfg(not(target_vendor = "apple"))] // FIXME: for currently not working platforms #[cfg(not(target_vendor = "apple"))] // FIXME: for currently not working platforms
fn test_stdin_redirect_file() { fn test_stdin_redirect_file() {
// $ echo foo > f // $ echo foo > f
@ -105,7 +103,7 @@ fn test_stdin_redirect_file() {
// $ tail < f // $ tail < f
// foo // foo
// $ tail -f < f // $ tail -v < f
// foo // foo
// //
@ -122,6 +120,22 @@ fn test_stdin_redirect_file() {
.arg("-v") .arg("-v")
.succeeds() .succeeds()
.stdout_only("==> standard input <==\nfoo"); .stdout_only("==> standard input <==\nfoo");
}
#[test]
// FIXME: the -f test fails with: Assertion failed. Expected 'tail' to be running but exited with status=exit status: 0
#[ignore = "disabled until fixed"]
#[cfg(not(target_vendor = "apple"))] // FIXME: for currently not working platforms
fn test_stdin_redirect_file_follow() {
// $ echo foo > f
// $ tail -f < f
// foo
//
let ts = TestScenario::new(util_name!());
let at = &ts.fixtures;
at.write("f", "foo");
let mut p = ts let mut p = ts
.ucmd() .ucmd()