Fix internal runner crash on binary files
This commit is contained in:
parent
660db66bb2
commit
d32e30eb77
1 changed files with 12 additions and 4 deletions
|
|
@ -71,12 +71,20 @@ fn count(run: &RunInProgress, path: &Path) -> somehow::Result<Counts> {
|
|||
let mut lines = 0;
|
||||
let mut todos = 0;
|
||||
for line in BufReader::new(File::open(entry.path())?).lines() {
|
||||
let line = line?;
|
||||
match line {
|
||||
Ok(line) => {
|
||||
lines += 1;
|
||||
if todo_regex.is_match(&line) {
|
||||
todos += 1;
|
||||
}
|
||||
}
|
||||
Err(_) => {
|
||||
// Probably a binary file
|
||||
lines = 0;
|
||||
todos = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
counts.files += 1;
|
||||
counts.lines += lines;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue