Skip to content

Commit f92ee6a

Browse files
authored
Merge pull request #7792 from karlmcdowall/tail_fix_v_option
tail: fix issue with -v flag and stdin
2 parents 1d89ea5 + e35ef16 commit f92ee6a

File tree

2 files changed

+20
-5
lines changed

2 files changed

+20
-5
lines changed

src/uu/tail/src/args.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,8 +290,9 @@ impl Settings {
290290
.map(|v| v.map(Input::from).collect())
291291
.unwrap_or_else(|| vec![Input::default()]);
292292

293-
settings.verbose =
294-
settings.inputs.len() > 1 && !matches.get_flag(options::verbosity::QUIET);
293+
settings.verbose = (matches.get_flag(options::verbosity::VERBOSE)
294+
|| settings.inputs.len() > 1)
295+
&& !matches.get_flag(options::verbosity::QUIET);
295296

296297
Ok(settings)
297298
}

tests/by-util/test_tail.rs

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,16 +96,14 @@ fn test_stdin_explicit() {
9696
}
9797

9898
#[test]
99-
// FIXME: the -f test fails with: Assertion failed. Expected 'tail' to be running but exited with status=exit status: 0
100-
#[ignore = "disabled until fixed"]
10199
#[cfg(not(target_vendor = "apple"))] // FIXME: for currently not working platforms
102100
fn test_stdin_redirect_file() {
103101
// $ echo foo > f
104102

105103
// $ tail < f
106104
// foo
107105

108-
// $ tail -f < f
106+
// $ tail -v < f
109107
// foo
110108
//
111109

@@ -122,6 +120,22 @@ fn test_stdin_redirect_file() {
122120
.arg("-v")
123121
.succeeds()
124122
.stdout_only("==> standard input <==\nfoo");
123+
}
124+
125+
#[test]
126+
// FIXME: the -f test fails with: Assertion failed. Expected 'tail' to be running but exited with status=exit status: 0
127+
#[ignore = "disabled until fixed"]
128+
#[cfg(not(target_vendor = "apple"))] // FIXME: for currently not working platforms
129+
fn test_stdin_redirect_file_follow() {
130+
// $ echo foo > f
131+
132+
// $ tail -f < f
133+
// foo
134+
//
135+
136+
let ts = TestScenario::new(util_name!());
137+
let at = &ts.fixtures;
138+
at.write("f", "foo");
125139

126140
let mut p = ts
127141
.ucmd()

0 commit comments

Comments
 (0)