From 598d4ce1744c0007c7f0e471f2888e2534a413c2 Mon Sep 17 00:00:00 2001 From: Ani Betts Date: Thu, 5 Dec 2024 09:53:23 +0100 Subject: [PATCH] Correctly handle when an executable is found but it's a symlink --- src/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index 8fbd456..d6412bf 100644 --- a/src/index.ts +++ b/src/index.ts @@ -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); } }