(err, stats)
| 3477 | } |
| 3478 | |
| 3479 | function gotStat(err, stats) { |
| 3480 | if (err) return callback(err); |
| 3481 | |
| 3482 | // If not a symlink, skip to the next path part |
| 3483 | if (!stats.isSymbolicLink()) { |
| 3484 | knownHard.add(base); |
| 3485 | return process.nextTick(LOOP); |
| 3486 | } |
| 3487 | |
| 3488 | // Stat & read the link if not read before. |
| 3489 | // Call `gotTarget()` as soon as the link target is known. |
| 3490 | // `dev`/`ino` always return 0 on windows, so skip the check. |
| 3491 | let id; |
| 3492 | if (!isWindows) { |
| 3493 | const dev = BigIntPrototypeToString(stats.dev, 32); |
| 3494 | const ino = BigIntPrototypeToString(stats.ino, 32); |
| 3495 | id = `${dev}:${ino}`; |
| 3496 | if (seenLinks.has(id)) { |
| 3497 | return gotTarget(null, seenLinks.get(id)); |
| 3498 | } |
| 3499 | } |
| 3500 | fs.stat(base, (err) => { |
| 3501 | if (err) return callback(err); |
| 3502 | |
| 3503 | fs.readlink(base, (err, target) => { |
| 3504 | if (!isWindows) seenLinks.set(id, target); |
| 3505 | gotTarget(err, target); |
| 3506 | }); |
| 3507 | }); |
| 3508 | } |
| 3509 | |
| 3510 | function gotTarget(err, target) { |
| 3511 | if (err) return callback(err); |
nothing calls this directly
no test coverage detected
searching dependent graphs…