Skip to content

Commit

Permalink
Merge pull request #295 from alexet/fix-non-regular-files
Browse files Browse the repository at this point in the history
Avoid reading non-regular files.
  • Loading branch information
boyter committed Oct 11, 2021
2 parents 182719b + adf3106 commit b458dee
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions processor/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,15 @@ func newFileJob(path, name string, fileInfo os.FileInfo) *FileJob {
fileInfo, _ = os.Lstat(symPath)
}

// Skip non-regular files. They are unlikely to be code and may hang if we
// try and read them.
if !fileInfo.Mode().IsRegular() {
if Verbose {
printWarn(fmt.Sprintf("skipping non-regular file: %s", path))
}
return nil
}

language, extension := DetectLanguage(name)

if len(language) != 0 {
Expand Down

0 comments on commit b458dee

Please sign in to comment.