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

pr: fix file not found in pr and mpr

This commit is contained in:
Tilak Patidar 2018-12-30 21:05:24 +05:30 committed by Max Semenik
parent 87227addc1
commit 8f9b322897

View file

@ -735,7 +735,7 @@ fn pr(path: &String, options: &OutputOptions) -> Result<i32, PrError> {
usize, usize,
Map<TakeWhile<SkipWhile<Map<Enumerate<Lines<BufReader<Box<Read>>>>, _>, _>, _>, _>, Map<TakeWhile<SkipWhile<Map<Enumerate<Lines<BufReader<Box<Read>>>>, _>, _>, _>, _>,
_, _,
> = BufReader::with_capacity(READ_BUFFER_SIZE, open(path).unwrap()) > = BufReader::with_capacity(READ_BUFFER_SIZE, open(path)?)
.lines() .lines()
.enumerate() .enumerate()
.map(|i: (usize, Result<String, IOError>)| FileLine { .map(|i: (usize, Result<String, IOError>)| FileLine {
@ -790,6 +790,11 @@ fn mpr(paths: &Vec<String>, options: &OutputOptions) -> Result<i32, PrError> {
let last_page: Option<&usize> = options.end_page.as_ref(); let last_page: Option<&usize> = options.end_page.as_ref();
let start_line_index_of_start_page = (start_page - 1) * lines_needed_per_page; let start_line_index_of_start_page = (start_page - 1) * lines_needed_per_page;
// Check if files exists
for path in paths {
open(path)?;
}
let file_line_groups: GroupBy< let file_line_groups: GroupBy<
usize, usize,
KMergeBy< KMergeBy<