From 8f9b3228978b73f9963c495edeee1fa10f5865e6 Mon Sep 17 00:00:00 2001 From: Tilak Patidar Date: Sun, 30 Dec 2018 21:05:24 +0530 Subject: [PATCH] pr: fix file not found in pr and mpr --- src/pr/pr.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/pr/pr.rs b/src/pr/pr.rs index 799507018..b799f8938 100644 --- a/src/pr/pr.rs +++ b/src/pr/pr.rs @@ -735,7 +735,7 @@ fn pr(path: &String, options: &OutputOptions) -> Result { usize, Map>>>, _>, _>, _>, _>, _, - > = BufReader::with_capacity(READ_BUFFER_SIZE, open(path).unwrap()) + > = BufReader::with_capacity(READ_BUFFER_SIZE, open(path)?) .lines() .enumerate() .map(|i: (usize, Result)| FileLine { @@ -790,6 +790,11 @@ fn mpr(paths: &Vec, options: &OutputOptions) -> Result { let last_page: Option<&usize> = options.end_page.as_ref(); 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< usize, KMergeBy<