Skip to content

Commit

Permalink
Correctly handle when an executable is found but it's a symlink
Browse files Browse the repository at this point in the history
  • Loading branch information
anaisbetts committed Dec 5, 2024
1 parent 1574328 commit 598d4ce
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,14 @@ function runDownPath(exe: string): string {
const target = path.join(".", exe);
if (statSyncNoException(target)) {
d(`Found executable in currect directory: ${target}`);
return target;
return sfs.realpathSync(target);
}

const haystack = process.env.PATH!.split(isWindows ? ";" : ":");
for (const p of haystack) {
const needle = path.join(p, exe);
if (statSyncNoException(needle)) {
return needle;
return sfs.realpathSync(needle);
}
}

Expand Down

0 comments on commit 598d4ce

Please sign in to comment.