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

tail: fix bug when following /dev/stdin

main panics when following /dev/stdin since /dev/stdin is not seekable.
Check to see if file is seekable and use unbounded_seek if so.

Also `tail -f` with no files should not follow stdin.
This commit is contained in:
Robert Clancy 2016-08-20 11:47:02 +01:00
parent 69e64e6c51
commit 3a0c23561e
2 changed files with 20 additions and 19 deletions

View file

@ -80,13 +80,7 @@ fn test_follow_multiple() {
#[test]
fn test_follow_stdin() {
let (at, mut ucmd) = at_and_ucmd();
let mut child = ucmd.arg("-f").pipe_in(at.read(FOOBAR_TXT)).run_no_wait();
let expected = at.read("follow_stdin.expected");
assert_eq!(read_size(&mut child, expected.len()), expected);
child.kill().unwrap();
new_ucmd().arg("-f").pipe_in_fixture(FOOBAR_TXT).run().stdout_is_fixture("follow_stdin.expected");
}
#[test]