mirror of
https://github.com/uutils/coreutils.git
synced 2026-06-10 15:48:22 -07:00
tail: show end of device
gnu coreutils will show end of device for block devices. In current implementation this is skipped as a block devices are recognized as untailable. The change ensures that we first try to output the end of any file and only then tell the observer that the file is not observable.
This commit is contained in:
+11
-9
@@ -177,7 +177,7 @@ fn tail_file(
|
||||
return Ok(());
|
||||
}
|
||||
observer.add_bad_path(path, input.display_name.as_str(), false)?;
|
||||
} else if input.is_tailable() {
|
||||
} else {
|
||||
match File::open(path) {
|
||||
Ok(mut file) => {
|
||||
let st = file.metadata()?;
|
||||
@@ -194,12 +194,16 @@ fn tail_file(
|
||||
reader = BufReader::new(file);
|
||||
unbounded_tail(&mut reader, settings)?;
|
||||
}
|
||||
observer.add_path(
|
||||
path,
|
||||
input.display_name.as_str(),
|
||||
Some(Box::new(reader)),
|
||||
true,
|
||||
)?;
|
||||
if input.is_tailable() {
|
||||
observer.add_path(
|
||||
path,
|
||||
input.display_name.as_str(),
|
||||
Some(Box::new(reader)),
|
||||
true,
|
||||
)?;
|
||||
} else {
|
||||
observer.add_bad_path(path, input.display_name.as_str(), false)?;
|
||||
}
|
||||
}
|
||||
Err(e) if e.kind() == ErrorKind::PermissionDenied => {
|
||||
observer.add_bad_path(path, input.display_name.as_str(), false)?;
|
||||
@@ -220,8 +224,6 @@ fn tail_file(
|
||||
}));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
observer.add_bad_path(path, input.display_name.as_str(), false)?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
||||
Reference in New Issue
Block a user