diff --git a/src/vs/base/node/extfs.ts b/src/vs/base/node/extfs.ts index 18400de99eef446156e7d1a8be8dd37712401b7e..82a1038af224d518646c13f8e8caa8ebe61256d9 100644 --- a/src/vs/base/node/extfs.ts +++ b/src/vs/base/node/extfs.ts @@ -49,21 +49,17 @@ export interface IStatAndLink { } export function statLink(path: string, callback: (error: Error, statAndIsLink: IStatAndLink) => void): void { - fs.lstat(path, (error, stat) => { - if (error) { - return callback(error, null); - } - - if (stat.isSymbolicLink()) { + fs.lstat(path, (error, lstat) => { + if (error || lstat.isSymbolicLink()) { fs.stat(path, (error, stat) => { if (error) { return callback(error, null); } - callback(null, { stat, isSymbolicLink: true }); + callback(null, { stat, isSymbolicLink: lstat && lstat.isSymbolicLink() }); }); } else { - callback(null, { stat, isSymbolicLink: false }); + callback(null, { stat: lstat, isSymbolicLink: false }); } }); }