Skip to content

Commit 24ec928

Browse files
committed
Use realpathSync.native in findBinPathDetailsSync
1 parent 577f430 commit 24ec928

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/utils/path-resolve.ts

+8-5
Original file line numberDiff line numberDiff line change
@@ -176,14 +176,17 @@ export function findBinPathDetailsSync(binName: string): {
176176
all: true,
177177
nothrow: true
178178
}) ?? []
179-
const binPath = bins.find((binPath, i) => {
179+
let binPath: string | undefined
180+
for (let i = 0, { length } = bins; i < length; i += 1) {
181+
const bin = realpathSync.native(bins[i]!)
180182
// Skip our bin directory if it's in the front.
181-
if (realpathSync(path.dirname(binPath)) === shadowBinPath) {
183+
if (path.dirname(bin) === shadowBinPath) {
182184
shadowIndex = i
183-
return false
185+
} else {
186+
binPath = bin
187+
break
184188
}
185-
return true
186-
})
189+
}
187190
return { name: binName, path: binPath, shadowed: shadowIndex !== -1 }
188191
}
189192

0 commit comments

Comments
 (0)