From 2d44626007455ccf632146477fcd8ffac7d70286 Mon Sep 17 00:00:00 2001 From: kerem Date: Tue, 8 Jan 2019 06:49:53 +0300 Subject: [PATCH] Expand functionality of `fileExists` function with executable check (#2230) --- src/goPath.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/goPath.ts b/src/goPath.ts index f0647b3f7..f82e060fb 100644 --- a/src/goPath.ts +++ b/src/goPath.ts @@ -87,11 +87,13 @@ function correctBinname(toolName: string) { } function fileExists(filePath: string): boolean { + let flag = true; try { - return fs.statSync(filePath).isFile(); + fs.accessSync(filePath, fs.constants.F_OK | fs.constants.X_OK); } catch (e) { - return false; + flag = false; } + return flag; } export function clearCacheForTools() {