Skip to content

Commit

Permalink
Merge pull request #905 from redhat-developer/msivasubramaniaan-patch-1
Browse files Browse the repository at this point in the history
added try catch block on lstatSync
  • Loading branch information
msivasubramaniaan committed Mar 16, 2023
2 parents 0d3a44c + 5abb668 commit 0b979a2
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/recommendation/openShiftToolkit.ts
Expand Up @@ -16,9 +16,13 @@ const RECOMMENDATION_MESSAGE = `The workspace has a devfile.yaml. Install [OpenS
const YAML_RECOMMENDATIONS_SHOW = 'yaml.recommendations.show';

function isDevfileYAML(uri: vscode.Uri): boolean {
if (fs.lstatSync(uri.fsPath).isDirectory()) {
const devFileYamlPath = path.join(uri.fsPath, 'devfile.yaml');
return fs.existsSync(devFileYamlPath);
try {
if (fs.lstatSync(uri.fsPath).isDirectory()) {
const devFileYamlPath = path.join(uri.fsPath, 'devfile.yaml');
return fs.existsSync(devFileYamlPath);
}
} catch (error) {
return false;
}
return !!uri.path && path.basename(uri.path).toLowerCase() === 'devfile.yaml';
}
Expand Down

0 comments on commit 0b979a2

Please sign in to comment.