code: function findAccessibleSync (logprefix, dir, candidates) {
    for (var next = 0; next < candidates.length; next++) {
       var candidate = path.resolve(dir, candidates[next])
       try {
         var fd = fs.openSync(candidate, 'r')
       } catch (e) {
         // this candidate was not found or not readable, do nothing
         log.silly(logprefix, 'Could not open %s: %s', candidate, e.message)
         continue
       }
       fs.closeSync(fd)
       log.silly(logprefix, 'Found readable %s', candidate)
       return candidate
    }
  
    return undefined
  }
docs: Returns the first file or directory from an array of candidates that is
  readable by the current user, or undefined if none of the candidates are
  readable.