Skip to content

Commit 1f6e3bf

Browse files
committed
Fix absolute paths not working on windows
1 parent 5f592a7 commit 1f6e3bf

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/utils.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,8 @@ function getWithRedirects(opts: https.RequestOptions, f: (res: http.IncomingMess
160160
* Checks if the executable is on the PATH
161161
*/
162162
export function executableExists(exe: string): boolean {
163-
const cmd: string = process.platform === 'win32' ? 'where' : 'which';
163+
const isWindows = process.platform === 'win32';
164+
const cmd: string = isWindows ? 'where' : 'which';
164165
const out = child_process.spawnSync(cmd, [exe]);
165-
return out.status === 0;
166+
return out.status === 0 || (isWindows && fs.existsSync(exe));
166167
}

0 commit comments

Comments
 (0)